mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-11-25 05:25:14 +00:00
Merge pull request #261 from zerocloude/rumble_back
Added rumble from Shindou version
This commit is contained in:
commit
a3ee774ba2
35 changed files with 141 additions and 272 deletions
2
build.sh
2
build.sh
|
@ -86,7 +86,7 @@ for i in ${!OPTIONS[@]}; do
|
|||
done
|
||||
|
||||
printf "\n${YELLOW} Executing: ${CYAN}make ${CMDL} -j${RESET}\n\n"
|
||||
PATH=/mingw32/bin:/mingw64/bin:$PATH make $CMDL -j -d
|
||||
PATH=/mingw32/bin:/mingw64/bin:$PATH make $CMDL -j
|
||||
|
||||
if [ "${CMDL}" != " clean" ]; then
|
||||
|
||||
|
|
|
@ -67,6 +67,7 @@
|
|||
#define TEXT_BIND_LEFT _("STICK LEFT")
|
||||
#define TEXT_BIND_RIGHT _("STICK RIGHT")
|
||||
#define TEXT_OPT_DEADZONE _("STICK DEADZONE")
|
||||
#define TEXT_OPT_RUMBLE _("RUMBLE STRENGTH")
|
||||
|
||||
#define TEXT_OPT_CHEAT1 _("ENABLE CHEATS")
|
||||
#define TEXT_OPT_CHEAT2 _("MOONJUMP (PRESS L)")
|
||||
|
@ -124,6 +125,7 @@
|
|||
#define TEXT_BIND_LEFT _("Stick Left")
|
||||
#define TEXT_BIND_RIGHT _("Stick Right")
|
||||
#define TEXT_OPT_DEADZONE _("Stick Deadzone")
|
||||
#define TEXT_OPT_RUMBLE _("Rumble Strength")
|
||||
|
||||
#define TEXT_OPT_CHEAT1 _("Enable cheats")
|
||||
#define TEXT_OPT_CHEAT2 _("Moonjump (Press L)")
|
||||
|
|
|
@ -30,9 +30,7 @@ struct Controller
|
|||
/*0x12*/ u16 buttonPressed;
|
||||
/*0x14*/ OSContStatus *statusData;
|
||||
/*0x18*/ OSContPad *controllerData;
|
||||
#ifdef VERSION_SH
|
||||
/*0x1C*/ int port;
|
||||
#endif
|
||||
};
|
||||
|
||||
typedef f32 Vec2f[2];
|
||||
|
|
|
@ -31,9 +31,7 @@ void cap_switch_act_2(void) {
|
|||
cur_obj_shake_screen(SHAKE_POS_SMALL);
|
||||
spawn_mist_particles();
|
||||
spawn_triangle_break_particles(60, 139, 0.3f, o->oBehParams2ndByte);
|
||||
#ifdef VERSION_SH
|
||||
queue_rumble_data(5, 80);
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
sp1C = cur_obj_update_dialog_with_cutscene(1, 0x0C, CUTSCENE_CAP_SWITCH_PRESS, 0);
|
||||
|
|
|
@ -78,9 +78,7 @@ void exclamation_box_act_2(void) {
|
|||
o->oGravity = -8.0f;
|
||||
o->oFloorHeight = o->oPosY;
|
||||
o->oAction = 3;
|
||||
#ifdef VERSION_SH
|
||||
queue_rumble_data(5, 80);
|
||||
#endif
|
||||
}
|
||||
load_object_collision_model();
|
||||
}
|
||||
|
|
|
@ -32,9 +32,7 @@ void bhv_purple_switch_loop(void) {
|
|||
cur_obj_play_sound_2(SOUND_GENERAL2_PURPLE_SWITCH);
|
||||
o->oAction = PURPLE_SWITCH_TICKING;
|
||||
cur_obj_shake_screen(SHAKE_POS_SMALL);
|
||||
#ifdef VERSION_SH
|
||||
queue_rumble_data(5, 80);
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
/**
|
||||
|
|
|
@ -22,9 +22,7 @@ void bhv_star_door_loop(void) {
|
|||
case 1:
|
||||
if (o->oTimer == 0 && (s16)(o->oMoveAngleYaw) >= 0) {
|
||||
cur_obj_play_sound_2(SOUND_GENERAL_STAR_DOOR_OPEN);
|
||||
#ifdef VERSION_SH
|
||||
queue_rumble_data(35, 30);
|
||||
#endif
|
||||
}
|
||||
cur_obj_become_intangible();
|
||||
o->oUnkBC = -8.0f;
|
||||
|
@ -39,9 +37,7 @@ void bhv_star_door_loop(void) {
|
|||
case 3:
|
||||
if (o->oTimer == 0 && (s16)(o->oMoveAngleYaw) >= 0) {
|
||||
cur_obj_play_sound_2(SOUND_GENERAL_STAR_DOOR_CLOSE);
|
||||
#ifdef VERSION_SH
|
||||
queue_rumble_data(35, 30);
|
||||
#endif
|
||||
}
|
||||
o->oUnkBC = 8.0f;
|
||||
star_door_update_pos();
|
||||
|
|
|
@ -40,9 +40,7 @@ void water_level_pillar_undrained(void) {
|
|||
(s32) approach_f32_symmetric(gEnvironmentLevels[2], -2450.0f, 5.0f);
|
||||
gEnvironmentLevels[0] =
|
||||
(s32) approach_f32_symmetric(gEnvironmentLevels[0], -2450.0f, 5.0f);
|
||||
#ifdef VERSION_SH
|
||||
reset_rumble_timers_2(2);
|
||||
#endif
|
||||
} else
|
||||
o->oAction++;
|
||||
break;
|
||||
|
|
|
@ -49,9 +49,7 @@ void bhv_water_level_diamond_loop(void) {
|
|||
cur_obj_play_sound_1(SOUND_ENV_WATER_DRAIN); // same as above
|
||||
}
|
||||
o->oAngleVelYaw = 0x800;
|
||||
#ifdef VERSION_SH
|
||||
reset_rumble_timers_2(2);
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
case WATER_LEVEL_DIAMOND_ACT_IDLE_SPINNING:
|
||||
|
|
|
@ -391,7 +391,7 @@ static void try_change_debug_page(void) {
|
|||
* sDebugSysCursor. This is used to adjust enemy and effect behaviors
|
||||
* on the fly. (unused)
|
||||
*/
|
||||
#ifndef VERSION_SH
|
||||
#ifdef VERSION_SH
|
||||
static
|
||||
#endif
|
||||
void try_modify_debug_controls(void) {
|
||||
|
@ -524,7 +524,7 @@ void try_do_mario_debug_object_spawn(void) {
|
|||
}
|
||||
|
||||
// TODO: figure out what this is
|
||||
#ifndef VERSION_SH
|
||||
#ifdef VERSION_SH
|
||||
static
|
||||
#endif
|
||||
void debug_print_obj_move_flags(void) {
|
||||
|
|
|
@ -564,9 +564,7 @@ void init_controllers(void) {
|
|||
// into any port in order to play the game. this was probably
|
||||
// so if any of the ports didnt work, you can have controllers
|
||||
// plugged into any of them and it will work.
|
||||
#ifdef VERSION_SH
|
||||
gControllers[cont].port = port;
|
||||
#endif
|
||||
gControllers[cont].statusData = &gControllerStatuses[port];
|
||||
gControllers[cont++].controllerData = &gControllerPads[port];
|
||||
}
|
||||
|
@ -606,13 +604,9 @@ static struct LevelCommand *levelCommandAddr;
|
|||
void thread5_game_loop(UNUSED void *arg) {
|
||||
|
||||
setup_game_memory();
|
||||
#ifdef VERSION_SH
|
||||
init_rumble_pak_scheduler_queue();
|
||||
#endif
|
||||
init_controllers();
|
||||
#ifdef VERSION_SH
|
||||
create_thread_6();
|
||||
#endif
|
||||
save_file_load_all();
|
||||
|
||||
set_vblank_handler(2, &gGameVblankHandler, &gGameVblankQueue, (OSMesg) 1);
|
||||
|
@ -638,9 +632,7 @@ void game_loop_one_iteration(void) {
|
|||
// read_controller_inputs is called later.
|
||||
if (gControllerBits) {
|
||||
|
||||
#ifdef VERSION_SH
|
||||
block_until_rumble_pak_free();
|
||||
#endif
|
||||
// block_until_rumble_pak_free();
|
||||
osContStartReadData(&gSIEventMesgQueue);
|
||||
}
|
||||
|
||||
|
|
|
@ -697,9 +697,7 @@ u32 take_damage_from_interact_object(struct MarioState *m) {
|
|||
|
||||
m->hurtCounter += 4 * damage;
|
||||
|
||||
#ifdef VERSION_SH
|
||||
queue_rumble_data(5, 80);
|
||||
#endif
|
||||
set_camera_shake_from_hit(shake);
|
||||
return damage;
|
||||
}
|
||||
|
@ -747,11 +745,10 @@ u32 interact_coin(struct MarioState *m, UNUSED u32 interactType, struct Object *
|
|||
&& m->numCoins >= 100) {
|
||||
bhv_spawn_star_no_level_exit(6);
|
||||
}
|
||||
#ifdef VERSION_SH
|
||||
|
||||
if (o->oDamageOrCoinValue >= 2) {
|
||||
queue_rumble_data(5, 80);
|
||||
}
|
||||
#endif
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -770,9 +767,7 @@ u32 interact_star_or_key(struct MarioState *m, UNUSED u32 interactType, struct O
|
|||
|
||||
if (m->health >= 0x100) {
|
||||
mario_stop_riding_and_holding(m);
|
||||
#ifdef VERSION_SH
|
||||
queue_rumble_data(5, 80);
|
||||
#endif
|
||||
|
||||
if (!noExit) {
|
||||
m->hurtCounter = 0;
|
||||
|
@ -874,7 +869,6 @@ u32 interact_warp(struct MarioState *m, UNUSED u32 interactType, struct Object *
|
|||
m->interactObj = o;
|
||||
m->usedObj = o;
|
||||
|
||||
#ifdef VERSION_SH
|
||||
if (o->collisionData == segmented_to_virtual(warp_pipe_seg3_collision_03009AC8)) {
|
||||
play_sound(SOUND_MENU_ENTER_PIPE, m->marioObj->header.gfx.cameraToObject);
|
||||
queue_rumble_data(15, 80);
|
||||
|
@ -882,12 +876,6 @@ u32 interact_warp(struct MarioState *m, UNUSED u32 interactType, struct Object *
|
|||
play_sound(SOUND_MENU_ENTER_HOLE, m->marioObj->header.gfx.cameraToObject);
|
||||
queue_rumble_data(12, 80);
|
||||
}
|
||||
#else
|
||||
play_sound(o->collisionData == segmented_to_virtual(warp_pipe_seg3_collision_03009AC8)
|
||||
? SOUND_MENU_ENTER_PIPE
|
||||
: SOUND_MENU_ENTER_HOLE,
|
||||
m->marioObj->header.gfx.cameraToObject);
|
||||
#endif
|
||||
|
||||
mario_stop_riding_object(m);
|
||||
return set_mario_action(m, ACT_DISAPPEARED, (WARP_OP_WARP_OBJECT << 16) + 2);
|
||||
|
@ -1098,9 +1086,8 @@ u32 interact_tornado(struct MarioState *m, UNUSED u32 interactType, struct Objec
|
|||
marioObj->oMarioTornadoPosY = m->pos[1] - o->oPosY;
|
||||
|
||||
play_sound(SOUND_MARIO_WAAAOOOW, m->marioObj->header.gfx.cameraToObject);
|
||||
#ifdef VERSION_SH
|
||||
queue_rumble_data(30, 60);
|
||||
#endif
|
||||
|
||||
return set_mario_action(m, ACT_TORNADO_TWIRLING, m->action == ACT_TWIRLING);
|
||||
}
|
||||
|
||||
|
@ -1121,9 +1108,8 @@ u32 interact_whirlpool(struct MarioState *m, UNUSED u32 interactType, struct Obj
|
|||
marioObj->oMarioWhirlpoolPosY = m->pos[1] - o->oPosY;
|
||||
|
||||
play_sound(SOUND_MARIO_WAAAOOOW, m->marioObj->header.gfx.cameraToObject);
|
||||
#ifdef VERSION_SH
|
||||
queue_rumble_data(30, 60);
|
||||
#endif
|
||||
|
||||
return set_mario_action(m, ACT_CAUGHT_IN_WHIRLPOOL, 0);
|
||||
}
|
||||
|
||||
|
@ -1157,9 +1143,8 @@ u32 interact_flame(struct MarioState *m, UNUSED u32 interactType, struct Object
|
|||
|
||||
if (!sInvulnerable && !(m->flags & MARIO_METAL_CAP) && !(m->flags & MARIO_VANISH_CAP)
|
||||
&& !(o->oInteractionSubtype & INT_SUBTYPE_DELAY_INVINCIBILITY)) {
|
||||
#ifdef VERSION_SH
|
||||
queue_rumble_data(5, 80);
|
||||
#endif
|
||||
|
||||
o->oInteractStatus = INT_STATUS_INTERACTED;
|
||||
m->interactObj = o;
|
||||
|
||||
|
@ -1235,9 +1220,7 @@ u32 interact_bully(struct MarioState *m, UNUSED u32 interactType, struct Object
|
|||
m->interactObj = o;
|
||||
|
||||
if (interaction & INT_ATTACK_NOT_FROM_BELOW) {
|
||||
#ifdef VERSION_SH
|
||||
queue_rumble_data(5, 80);
|
||||
#endif
|
||||
push_mario_out_of_object(m, o, 5.0f);
|
||||
|
||||
m->forwardVel = -16.0f;
|
||||
|
@ -1260,9 +1243,8 @@ u32 interact_bully(struct MarioState *m, UNUSED u32 interactType, struct Object
|
|||
|
||||
push_mario_out_of_object(m, o, 5.0f);
|
||||
drop_and_set_mario_action(m, bully_knock_back_mario(m), 0);
|
||||
#ifdef VERSION_SH
|
||||
queue_rumble_data(5, 80);
|
||||
#endif
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -1279,9 +1261,7 @@ u32 interact_shock(struct MarioState *m, UNUSED u32 interactType, struct Object
|
|||
|
||||
take_damage_from_interact_object(m);
|
||||
play_sound(SOUND_MARIO_ATTACKED, m->marioObj->header.gfx.cameraToObject);
|
||||
#ifdef VERSION_SH
|
||||
queue_rumble_data(70, 60);
|
||||
#endif
|
||||
|
||||
if (m->action & (ACT_FLAG_SWIMMING | ACT_FLAG_METAL_WATER)) {
|
||||
return drop_and_set_mario_action(m, ACT_WATER_SHOCKED, 0);
|
||||
|
@ -1327,9 +1307,7 @@ u32 interact_hit_from_below(struct MarioState *m, UNUSED u32 interactType, struc
|
|||
}
|
||||
|
||||
if (interaction & INT_ANY_ATTACK) {
|
||||
#ifdef VERSION_SH
|
||||
queue_rumble_data(5, 80);
|
||||
#endif
|
||||
attack_object(o, interaction);
|
||||
bounce_back_from_attack(m, interaction);
|
||||
|
||||
|
@ -1368,9 +1346,7 @@ u32 interact_bounce_top(struct MarioState *m, UNUSED u32 interactType, struct Ob
|
|||
}
|
||||
|
||||
if (interaction & INT_ATTACK_NOT_FROM_BELOW) {
|
||||
#ifdef VERSION_SH
|
||||
queue_rumble_data(5, 80);
|
||||
#endif
|
||||
attack_object(o, interaction);
|
||||
bounce_back_from_attack(m, interaction);
|
||||
|
||||
|
@ -1487,9 +1463,7 @@ u32 check_object_grab_mario(struct MarioState *m, UNUSED u32 interactType, struc
|
|||
|
||||
update_mario_sound_and_camera(m);
|
||||
play_sound(SOUND_MARIO_OOOF, m->marioObj->header.gfx.cameraToObject);
|
||||
#ifdef VERSION_SH
|
||||
queue_rumble_data(5, 80);
|
||||
#endif
|
||||
return set_mario_action(m, ACT_GRABBED, 0);
|
||||
}
|
||||
}
|
||||
|
@ -1538,9 +1512,7 @@ u32 interact_pole(struct MarioState *m, UNUSED u32 interactType, struct Object *
|
|||
marioObj->oMarioPoleYawVel = (s32)(m->forwardVel * 0x100 + 0x1000);
|
||||
#endif
|
||||
reset_mario_pitch(m);
|
||||
#ifdef VERSION_SH
|
||||
queue_rumble_data(5, 80);
|
||||
#endif
|
||||
return set_mario_action(m, ACT_GRAB_POLE_FAST, 0);
|
||||
}
|
||||
}
|
||||
|
@ -1560,9 +1532,7 @@ u32 interact_hoot(struct MarioState *m, UNUSED u32 interactType, struct Object *
|
|||
m->interactObj = o;
|
||||
m->usedObj = o;
|
||||
|
||||
#ifdef VERSION_SH
|
||||
queue_rumble_data(5, 80);
|
||||
#endif
|
||||
update_mario_sound_and_camera(m);
|
||||
return set_mario_action(m, ACT_RIDING_HOOT, 0);
|
||||
}
|
||||
|
|
|
@ -687,10 +687,8 @@ void initiate_painting_warp(void) {
|
|||
|
||||
play_sound(SOUND_MENU_STAR_SOUND, gDefaultSoundArgs);
|
||||
fadeout_music(398);
|
||||
#ifdef VERSION_SH
|
||||
queue_rumble_data(80, 70);
|
||||
func_sh_8024C89C(1);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1005,9 +1003,7 @@ s32 play_mode_normal(void) {
|
|||
set_play_mode(PLAY_MODE_CHANGE_AREA);
|
||||
} else if (pressed_pause()) {
|
||||
lower_background_noise(1);
|
||||
#ifdef VERSION_SH
|
||||
cancel_rumble();
|
||||
#endif
|
||||
gCameraMovementFlags |= CAM_MOVE_PAUSE_SCREEN;
|
||||
set_play_mode(PLAY_MODE_PAUSED);
|
||||
}
|
||||
|
@ -1225,11 +1221,10 @@ s32 init_level(void) {
|
|||
set_background_music(gCurrentArea->musicParam, gCurrentArea->musicParam2, 0);
|
||||
}
|
||||
}
|
||||
#ifdef VERSION_SH
|
||||
|
||||
if (gCurrDemoInput == NULL) {
|
||||
cancel_rumble();
|
||||
}
|
||||
#endif
|
||||
|
||||
if (gMarioState->action == ACT_INTRO_CUTSCENE) {
|
||||
sound_banks_disable(2, 0x0330);
|
||||
|
|
|
@ -13,6 +13,12 @@
|
|||
#include "main.h"
|
||||
#include "thread6.h"
|
||||
|
||||
/**
|
||||
* WARNING!
|
||||
* This entry point is deprecated because TARGET_N64 is no longer required for building PC version.
|
||||
* The new entry point is located in 'pc/pc_main.c'
|
||||
**/
|
||||
|
||||
// Message IDs
|
||||
#define MESG_SP_COMPLETE 100
|
||||
#define MESG_DP_COMPLETE 101
|
||||
|
@ -25,11 +31,6 @@ OSThread gIdleThread;
|
|||
OSThread gMainThread;
|
||||
OSThread gGameLoopThread;
|
||||
OSThread gSoundThread;
|
||||
#ifdef VERSION_SH
|
||||
OSThread gRumblePakThread;
|
||||
|
||||
s32 gRumblePakPfs; // Actually an OSPfs but we don't have that header yet
|
||||
#endif
|
||||
|
||||
OSIoMesg gDmaIoMesg;
|
||||
OSMesg D_80339BEC;
|
||||
|
@ -38,19 +39,20 @@ OSMesgQueue gSIEventMesgQueue;
|
|||
OSMesgQueue gPIMesgQueue;
|
||||
OSMesgQueue gIntrMesgQueue;
|
||||
OSMesgQueue gSPTaskMesgQueue;
|
||||
#ifdef VERSION_SH
|
||||
OSMesgQueue gRumblePakSchedulerMesgQueue;
|
||||
OSMesgQueue gRumbleThreadVIMesgQueue;
|
||||
#endif
|
||||
OSMesg gDmaMesgBuf[1];
|
||||
OSMesg gPIMesgBuf[32];
|
||||
OSMesg gSIEventMesgBuf[1];
|
||||
OSMesg gIntrMesgBuf[16];
|
||||
OSMesg gUnknownMesgBuf[16];
|
||||
|
||||
#ifdef VERSION_SH
|
||||
OSThread gRumblePakThread;
|
||||
OSMesgQueue gRumblePakSchedulerMesgQueue;
|
||||
OSMesgQueue gRumbleThreadVIMesgQueue;
|
||||
OSMesg gRumblePakSchedulerMesgBuf[1];
|
||||
OSMesg gRumbleThreadVIMesgBuf[1];
|
||||
|
||||
s32 gRumblePakPfs; // Actually an OSPfs but we don't have that header yet
|
||||
struct RumbleData gRumbleDataQueue[3];
|
||||
struct StructSH8031D9B0 gCurrRumbleSettings;
|
||||
#endif
|
||||
|
@ -268,9 +270,8 @@ void handle_vblank(void) {
|
|||
start_sptask(M_GFXTASK);
|
||||
}
|
||||
}
|
||||
#ifdef VERSION_SH
|
||||
|
||||
rumble_thread_update_vi();
|
||||
#endif
|
||||
|
||||
// Notify the game loop about the vblank.
|
||||
if (gVblankHandler1 != NULL) {
|
||||
|
|
|
@ -24,19 +24,11 @@ extern OSThread gIdleThread;
|
|||
extern OSThread gMainThread;
|
||||
extern OSThread gGameLoopThread;
|
||||
extern OSThread gSoundThread;
|
||||
#ifdef VERSION_SH
|
||||
extern OSThread gRumblePakThread;
|
||||
|
||||
extern s32 gRumblePakPfs; // Actually an OSPfs but we don't have that header yet
|
||||
#endif
|
||||
|
||||
extern OSMesgQueue gPIMesgQueue;
|
||||
extern OSMesgQueue gIntrMesgQueue;
|
||||
extern OSMesgQueue gSPTaskMesgQueue;
|
||||
#ifdef VERSION_SH
|
||||
extern OSMesgQueue gRumblePakSchedulerMesgQueue;
|
||||
extern OSMesgQueue gRumbleThreadVIMesgQueue;
|
||||
#endif
|
||||
|
||||
extern OSMesg gDmaMesgBuf[1];
|
||||
extern OSMesg gPIMesgBuf[32];
|
||||
extern OSMesg gSIEventMesgBuf[1];
|
||||
|
@ -46,13 +38,18 @@ extern OSIoMesg gDmaIoMesg;
|
|||
extern OSMesg D_80339BEC;
|
||||
extern OSMesgQueue gDmaMesgQueue;
|
||||
extern OSMesgQueue gSIEventMesgQueue;
|
||||
|
||||
#ifdef VERSION_SH
|
||||
extern OSThread gRumblePakThread;
|
||||
extern OSMesg gRumblePakSchedulerMesgBuf[1];
|
||||
extern OSMesg gRumbleThreadVIMesgBuf[1];
|
||||
extern OSMesgQueue gRumblePakSchedulerMesgQueue;
|
||||
extern OSMesgQueue gRumbleThreadVIMesgQueue;
|
||||
#endif
|
||||
|
||||
extern s32 gRumblePakPfs; // Actually an OSPfs but we don't have that header yet
|
||||
extern struct RumbleData gRumbleDataQueue[3];
|
||||
extern struct StructSH8031D9B0 gCurrRumbleSettings;
|
||||
#endif
|
||||
|
||||
extern struct VblankHandler *gVblankHandler1;
|
||||
extern struct VblankHandler *gVblankHandler2;
|
||||
|
@ -73,6 +70,6 @@ extern s8 gShowDebugText;
|
|||
extern void set_vblank_handler(s32 a, struct VblankHandler *b, OSMesgQueue *queue, OSMesg *msg);
|
||||
extern void dispatch_audio_sptask(struct SPTask *spTask);
|
||||
extern void send_display_list(struct SPTask *a);
|
||||
extern void main(void);
|
||||
// extern void main(void);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1534,7 +1534,6 @@ void update_mario_health(struct MarioState *m) {
|
|||
// Play a noise to alert the player when Mario is close to drowning.
|
||||
if (((m->action & ACT_GROUP_MASK) == ACT_GROUP_SUBMERGED) && (m->health < 0x300)) {
|
||||
play_sound(SOUND_MOVING_ALMOST_DROWNING, gDefaultSoundArgs);
|
||||
#ifdef VERSION_SH
|
||||
if (!gRumblePakTimer) {
|
||||
gRumblePakTimer = 36;
|
||||
if (is_rumble_finished_and_queue_empty()) {
|
||||
|
@ -1543,7 +1542,6 @@ void update_mario_health(struct MarioState *m) {
|
|||
}
|
||||
} else {
|
||||
gRumblePakTimer = 0;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1721,7 +1719,6 @@ static void debug_update_mario_cap(u16 button, s32 flags, u16 capTimer, u16 capM
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef VERSION_SH
|
||||
void func_sh_8025574C(void) {
|
||||
if (gMarioState->particleFlags & PARTICLE_HORIZONTAL_STAR) {
|
||||
queue_rumble_data(5, 80);
|
||||
|
@ -1734,7 +1731,6 @@ void func_sh_8025574C(void) {
|
|||
reset_rumble_timers();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Main function for executing Mario's behavior.
|
||||
|
@ -1831,9 +1827,7 @@ s32 execute_mario_action(UNUSED struct Object *o) {
|
|||
|
||||
play_infinite_stairs_music();
|
||||
gMarioState->marioObj->oInteractStatus = 0;
|
||||
#ifdef VERSION_SH
|
||||
func_sh_8025574C();
|
||||
#endif
|
||||
|
||||
return gMarioState->particleFlags;
|
||||
}
|
||||
|
|
|
@ -83,18 +83,15 @@ s32 check_fall_damage(struct MarioState *m, u32 hardFallAction) {
|
|||
if (m->vel[1] < -55.0f) {
|
||||
if (fallHeight > 3000.0f) {
|
||||
m->hurtCounter += (m->flags & MARIO_CAP_ON_HEAD) ? 16 : 24;
|
||||
#ifdef VERSION_SH
|
||||
queue_rumble_data(5, 80);
|
||||
#endif
|
||||
set_camera_shake_from_hit(SHAKE_FALL_DAMAGE);
|
||||
play_sound(SOUND_MARIO_ATTACKED, m->marioObj->header.gfx.cameraToObject);
|
||||
return drop_and_set_mario_action(m, hardFallAction, 4);
|
||||
} else if (fallHeight > damageHeight && !mario_floor_is_slippery(m)) {
|
||||
m->hurtCounter += (m->flags & MARIO_CAP_ON_HEAD) ? 8 : 12;
|
||||
m->squishTimer = 30;
|
||||
#ifdef VERSION_SH
|
||||
|
||||
queue_rumble_data(5, 80);
|
||||
#endif
|
||||
set_camera_shake_from_hit(SHAKE_FALL_DAMAGE);
|
||||
play_sound(SOUND_MARIO_ATTACKED, m->marioObj->header.gfx.cameraToObject);
|
||||
}
|
||||
|
@ -136,9 +133,8 @@ s32 check_fall_damage_or_get_stuck(struct MarioState *m, u32 hardFallAction) {
|
|||
#endif
|
||||
m->particleFlags |= PARTICLE_MIST_CIRCLE;
|
||||
drop_and_set_mario_action(m, ACT_FEET_STUCK_IN_GROUND, 0);
|
||||
#ifdef VERSION_SH
|
||||
|
||||
queue_rumble_data(5, 80);
|
||||
#endif
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -388,9 +384,7 @@ u32 common_air_action_step(struct MarioState *m, u32 landAction, s32 animation,
|
|||
set_mario_animation(m, animation);
|
||||
|
||||
if (m->forwardVel > 16.0f) {
|
||||
#ifdef VERSION_SH
|
||||
queue_rumble_data(5, 40);
|
||||
#endif
|
||||
mario_bonk_reflection(m, FALSE);
|
||||
m->faceAngle[1] += 0x8000;
|
||||
|
||||
|
@ -496,11 +490,9 @@ s32 act_triple_jump(struct MarioState *m) {
|
|||
#endif
|
||||
|
||||
common_air_action_step(m, ACT_TRIPLE_JUMP_LAND, MARIO_ANIM_TRIPLE_JUMP, 0);
|
||||
#ifdef VERSION_SH
|
||||
if (m->action == ACT_TRIPLE_JUMP_LAND) {
|
||||
queue_rumble_data(5, 40);
|
||||
}
|
||||
#endif
|
||||
play_flip_sounds(m, 2, 8, 20);
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -512,11 +504,10 @@ s32 act_backflip(struct MarioState *m) {
|
|||
|
||||
play_mario_sound(m, SOUND_ACTION_TERRAIN_JUMP, SOUND_MARIO_YAH_WAH_HOO);
|
||||
common_air_action_step(m, ACT_BACKFLIP_LAND, MARIO_ANIM_BACKFLIP, 0);
|
||||
#ifdef VERSION_SH
|
||||
|
||||
if (m->action == ACT_BACKFLIP_LAND) {
|
||||
queue_rumble_data(5, 40);
|
||||
}
|
||||
#endif
|
||||
play_flip_sounds(m, 2, 3, 17);
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -644,11 +635,10 @@ s32 act_long_jump(struct MarioState *m) {
|
|||
}
|
||||
|
||||
common_air_action_step(m, ACT_LONG_JUMP_LAND, animation, AIR_STEP_CHECK_LEDGE_GRAB);
|
||||
#ifdef VERSION_SH
|
||||
|
||||
if (m->action == ACT_LONG_JUMP_LAND) {
|
||||
queue_rumble_data(5, 40);
|
||||
}
|
||||
#endif
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -749,9 +739,7 @@ s32 act_dive(struct MarioState *m) {
|
|||
|
||||
case AIR_STEP_LANDED:
|
||||
if (should_get_stuck_in_ground(m) && m->faceAngle[0] == -0x2AAA) {
|
||||
#ifdef VERSION_SH
|
||||
queue_rumble_data(5, 80);
|
||||
#endif
|
||||
#ifdef VERSION_JP
|
||||
play_sound(SOUND_MARIO_OOOF, m->marioObj->header.gfx.cameraToObject);
|
||||
#else
|
||||
|
@ -947,9 +935,7 @@ s32 act_ground_pound(struct MarioState *m) {
|
|||
stepResult = perform_air_step(m, 0);
|
||||
if (stepResult == AIR_STEP_LANDED) {
|
||||
if (should_get_stuck_in_ground(m)) {
|
||||
#ifdef VERSION_SH
|
||||
queue_rumble_data(5, 80);
|
||||
#endif
|
||||
#ifdef VERSION_JP
|
||||
play_sound(SOUND_MARIO_OOOF, m->marioObj->header.gfx.cameraToObject);
|
||||
#else
|
||||
|
@ -998,9 +984,8 @@ s32 act_burning_jump(struct MarioState *m) {
|
|||
if (m->health < 0x100) {
|
||||
m->health = 0xFF;
|
||||
}
|
||||
#ifdef VERSION_SH
|
||||
|
||||
reset_rumble_timers();
|
||||
#endif
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -1020,9 +1005,8 @@ s32 act_burning_fall(struct MarioState *m) {
|
|||
if (m->health < 0x100) {
|
||||
m->health = 0xFF;
|
||||
}
|
||||
#ifdef VERSION_SH
|
||||
|
||||
reset_rumble_timers();
|
||||
#endif
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -1071,9 +1055,7 @@ s32 act_crazy_box_bounce(struct MarioState *m) {
|
|||
m->heldObj = NULL;
|
||||
set_mario_action(m, ACT_STOMACH_SLIDE, 0);
|
||||
}
|
||||
#ifdef VERSION_SH
|
||||
queue_rumble_data(5, 80);
|
||||
#endif
|
||||
m->particleFlags |= PARTICLE_MIST_CIRCLE;
|
||||
break;
|
||||
|
||||
|
@ -1103,11 +1085,9 @@ u32 common_air_knockback_step(struct MarioState *m, u32 landAction, u32 hardFall
|
|||
break;
|
||||
|
||||
case AIR_STEP_LANDED:
|
||||
#ifdef VERSION_SH
|
||||
if (m->action == ACT_SOFT_BONK) {
|
||||
queue_rumble_data(5, 80);
|
||||
}
|
||||
#endif
|
||||
if (!check_fall_damage_or_get_stuck(m, hardFallAction)) {
|
||||
#ifndef VERSION_JP
|
||||
if (m->action == ACT_THROWN_FORWARD || m->action == ACT_THROWN_BACKWARD) {
|
||||
|
@ -1506,14 +1486,11 @@ s32 act_hold_butt_slide_air(struct MarioState *m) {
|
|||
}
|
||||
|
||||
s32 act_lava_boost(struct MarioState *m) {
|
||||
#ifdef VERSION_SH
|
||||
if (!(m->flags & MARIO_MARIO_SOUND_PLAYED)) {
|
||||
play_sound_if_no_flag(m, SOUND_MARIO_ON_FIRE, MARIO_MARIO_SOUND_PLAYED);
|
||||
queue_rumble_data(5, 80);
|
||||
}
|
||||
#else
|
||||
play_sound_if_no_flag(m, SOUND_MARIO_ON_FIRE, MARIO_MARIO_SOUND_PLAYED);
|
||||
#endif
|
||||
|
||||
if (!(m->input & INPUT_NONZERO_ANALOG)) {
|
||||
m->forwardVel = approach_f32(m->forwardVel, 0.0f, 0.35f, 0.35f);
|
||||
|
@ -1530,9 +1507,7 @@ s32 act_lava_boost(struct MarioState *m) {
|
|||
}
|
||||
m->vel[1] = 84.0f;
|
||||
play_sound(SOUND_MARIO_ON_FIRE, m->marioObj->header.gfx.cameraToObject);
|
||||
#ifdef VERSION_SH
|
||||
queue_rumble_data(5, 80);
|
||||
#endif
|
||||
} else {
|
||||
play_mario_heavy_landing_sound(m, SOUND_ACTION_TERRAIN_BODY_HIT_GROUND);
|
||||
if (m->actionState < 2 && m->vel[1] < 0.0f) {
|
||||
|
@ -1568,9 +1543,8 @@ s32 act_lava_boost(struct MarioState *m) {
|
|||
}
|
||||
|
||||
m->marioBodyState->eyeState = MARIO_EYES_DEAD;
|
||||
#ifdef VERSION_SH
|
||||
|
||||
reset_rumble_timers();
|
||||
#endif
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -1690,9 +1664,7 @@ s32 act_shot_from_cannon(struct MarioState *m) {
|
|||
gLakituState.mode = CAMERA_MODE_NEWCAM;
|
||||
}
|
||||
#endif
|
||||
#ifdef VERSION_SH
|
||||
queue_rumble_data(5, 80);
|
||||
#endif
|
||||
break;
|
||||
|
||||
case AIR_STEP_HIT_WALL:
|
||||
|
@ -1734,9 +1706,8 @@ s32 act_shot_from_cannon(struct MarioState *m) {
|
|||
if (m->vel[1] > 0.0f) {
|
||||
m->particleFlags |= PARTICLE_DUST;
|
||||
}
|
||||
#ifdef VERSION_SH
|
||||
|
||||
reset_rumble_timers();
|
||||
#endif
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -1839,9 +1810,7 @@ s32 act_flying(struct MarioState *m) {
|
|||
gLakituState.mode = CAMERA_MODE_NEWCAM;
|
||||
}
|
||||
#endif
|
||||
#ifdef VERSION_SH
|
||||
queue_rumble_data(5, 80);
|
||||
#endif
|
||||
break;
|
||||
|
||||
case AIR_STEP_HIT_WALL:
|
||||
|
@ -1904,9 +1873,7 @@ s32 act_flying(struct MarioState *m) {
|
|||
play_sound(SOUND_MARIO_YAHOO_WAHA_YIPPEE + ((gAudioRandom % 5) << 16),
|
||||
m->marioObj->header.gfx.cameraToObject);
|
||||
#endif
|
||||
#ifdef VERSION_SH
|
||||
queue_rumble_data(50, 40);
|
||||
#endif
|
||||
}
|
||||
|
||||
play_sound(SOUND_MOVING_FLYING, m->marioObj->header.gfx.cameraToObject);
|
||||
|
@ -1920,9 +1887,7 @@ s32 act_riding_hoot(struct MarioState *m) {
|
|||
m->usedObj->oHootMarioReleaseTime = gGlobalTimer;
|
||||
|
||||
play_sound_if_no_flag(m, SOUND_MARIO_UH, MARIO_MARIO_SOUND_PLAYED);
|
||||
#ifdef VERSION_SH
|
||||
queue_rumble_data(4, 40);
|
||||
#endif
|
||||
return set_mario_action(m, ACT_FREEFALL, 0);
|
||||
}
|
||||
|
||||
|
@ -1988,9 +1953,7 @@ s32 act_flying_triple_jump(struct MarioState *m) {
|
|||
|
||||
if (is_anim_past_end(m)) {
|
||||
set_mario_animation(m, MARIO_ANIM_FORWARD_SPINNING);
|
||||
#ifdef VERSION_SH
|
||||
queue_rumble_data(8, 80);
|
||||
#endif
|
||||
m->actionState = 1;
|
||||
}
|
||||
}
|
||||
|
@ -2063,9 +2026,7 @@ s32 act_vertical_wind(struct MarioState *m) {
|
|||
set_mario_animation(m, MARIO_ANIM_FORWARD_SPINNING_FLIP);
|
||||
if (m->marioObj->header.gfx.unk38.animFrame == 1) {
|
||||
play_sound(SOUND_ACTION_SPIN, m->marioObj->header.gfx.cameraToObject);
|
||||
#ifdef VERSION_SH
|
||||
queue_rumble_data(8, 80);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (is_anim_past_end(m)) {
|
||||
|
|
|
@ -171,9 +171,7 @@ s32 act_holding_pole(struct MarioState *m) {
|
|||
}
|
||||
}
|
||||
play_climbing_sounds(m, 2);
|
||||
#ifdef VERSION_SH
|
||||
reset_rumble_timers();
|
||||
#endif
|
||||
func_80320A4C(1, marioObj->oMarioPoleYawVel / 0x100 * 2);
|
||||
} else {
|
||||
marioObj->oMarioPoleYawVel = 0;
|
||||
|
@ -385,13 +383,9 @@ void update_hang_stationary(struct MarioState *m) {
|
|||
}
|
||||
|
||||
s32 act_start_hanging(struct MarioState *m) {
|
||||
#ifdef VERSION_SH
|
||||
if (m->actionTimer++ == 0) {
|
||||
queue_rumble_data(5, 80);
|
||||
}
|
||||
#else
|
||||
m->actionTimer++;
|
||||
#endif
|
||||
|
||||
if ((m->input & INPUT_NONZERO_ANALOG) && m->actionTimer >= 31) {
|
||||
return set_mario_action(m, ACT_HANGING, 0);
|
||||
|
@ -470,9 +464,7 @@ s32 act_hang_moving(struct MarioState *m) {
|
|||
|
||||
if (m->marioObj->header.gfx.unk38.animFrame == 12) {
|
||||
play_sound(SOUND_ACTION_HANGING_STEP, m->marioObj->header.gfx.cameraToObject);
|
||||
#ifdef VERSION_SH
|
||||
queue_rumble_data(5, 30);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (is_anim_past_end(m)) {
|
||||
|
@ -662,9 +654,7 @@ s32 act_grabbed(struct MarioState *m) {
|
|||
|
||||
m->faceAngle[1] = m->usedObj->oMoveAngleYaw;
|
||||
vec3f_copy(m->pos, m->marioObj->header.gfx.pos);
|
||||
#ifdef VERSION_SH
|
||||
queue_rumble_data(5, 60);
|
||||
#endif
|
||||
|
||||
return set_mario_action(m, (m->forwardVel >= 0.0f) ? ACT_THROWN_FORWARD : ACT_THROWN_BACKWARD,
|
||||
thrown);
|
||||
|
@ -744,17 +734,13 @@ s32 act_in_cannon(struct MarioState *m) {
|
|||
m->marioObj->header.gfx.node.flags |= GRAPH_RENDER_ACTIVE;
|
||||
|
||||
set_mario_action(m, ACT_SHOT_FROM_CANNON, 0);
|
||||
#ifdef VERSION_SH
|
||||
queue_rumble_data(60, 70);
|
||||
#endif
|
||||
m->usedObj->oAction = 2;
|
||||
return FALSE;
|
||||
} else {
|
||||
if (m->faceAngle[0] != startFacePitch || m->faceAngle[1] != startFaceYaw) {
|
||||
play_sound(SOUND_MOVING_AIM_CANNON, m->marioObj->header.gfx.cameraToObject);
|
||||
#ifdef VERSION_SH
|
||||
reset_rumble_timers_2(0);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -840,9 +826,7 @@ s32 act_tornado_twirling(struct MarioState *m) {
|
|||
|
||||
vec3f_copy(m->marioObj->header.gfx.pos, m->pos);
|
||||
vec3s_set(m->marioObj->header.gfx.angle, 0, m->faceAngle[1] + m->twirlYaw, 0);
|
||||
#ifdef VERSION_SH
|
||||
reset_rumble_timers();
|
||||
#endif
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
@ -1178,9 +1178,7 @@ s32 act_death_exit(struct MarioState *m) {
|
|||
#else
|
||||
play_sound(SOUND_MARIO_OOOF2, m->marioObj->header.gfx.cameraToObject);
|
||||
#endif
|
||||
#ifdef VERSION_SH
|
||||
queue_rumble_data(5, 80);
|
||||
#endif
|
||||
m->numLives--;
|
||||
// restore 7.75 units of health
|
||||
m->healCounter = 31;
|
||||
|
@ -1213,9 +1211,7 @@ s32 act_falling_death_exit(struct MarioState *m) {
|
|||
#else
|
||||
play_sound(SOUND_MARIO_OOOF2, m->marioObj->header.gfx.cameraToObject);
|
||||
#endif
|
||||
#ifdef VERSION_SH
|
||||
queue_rumble_data(5, 80);
|
||||
#endif
|
||||
m->numLives--;
|
||||
// restore 7.75 units of health
|
||||
m->healCounter = 31;
|
||||
|
@ -1260,9 +1256,7 @@ s32 act_special_death_exit(struct MarioState *m) {
|
|||
}
|
||||
|
||||
if (launch_mario_until_land(m, ACT_HARD_BACKWARD_GROUND_KB, MARIO_ANIM_BACKWARD_AIR_KB, -24.0f)) {
|
||||
#ifdef VERSION_SH
|
||||
queue_rumble_data(5, 80);
|
||||
#endif
|
||||
m->numLives--;
|
||||
m->healCounter = 31;
|
||||
}
|
||||
|
@ -1346,9 +1340,7 @@ s32 act_bbh_enter_spin(struct MarioState *m) {
|
|||
m->flags &= ~MARIO_UNKNOWN_08;
|
||||
if (perform_air_step(m, 0) == AIR_STEP_LANDED) {
|
||||
level_trigger_warp(m, WARP_OP_UNKNOWN_02);
|
||||
#ifdef VERSION_SH
|
||||
queue_rumble_data(15, 80);
|
||||
#endif
|
||||
m->actionState = 4;
|
||||
}
|
||||
if (m->actionState == 2) {
|
||||
|
@ -1414,12 +1406,10 @@ s32 act_teleport_fade_out(struct MarioState *m) {
|
|||
set_mario_animation(m, m->prevAction == ACT_CROUCHING ? MARIO_ANIM_CROUCHING
|
||||
: MARIO_ANIM_FIRST_PERSON);
|
||||
|
||||
#ifdef VERSION_SH
|
||||
if (m->actionTimer == 0) {
|
||||
queue_rumble_data(30, 70);
|
||||
func_sh_8024C89C(2);
|
||||
}
|
||||
#endif
|
||||
|
||||
m->flags |= MARIO_TELEPORTING;
|
||||
|
||||
|
@ -1440,12 +1430,10 @@ s32 act_teleport_fade_in(struct MarioState *m) {
|
|||
play_sound_if_no_flag(m, SOUND_ACTION_TELEPORT, MARIO_ACTION_SOUND_PLAYED);
|
||||
set_mario_animation(m, MARIO_ANIM_FIRST_PERSON);
|
||||
|
||||
#ifdef VERSION_SH
|
||||
if (m->actionTimer == 0) {
|
||||
queue_rumble_data(30, 70);
|
||||
func_sh_8024C89C(2);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (m->actionTimer < 32) {
|
||||
m->flags |= MARIO_TELEPORTING;
|
||||
|
@ -1534,9 +1522,7 @@ s32 act_squished(struct MarioState *m) {
|
|||
// Both of the 1.8's are really floats, but one of them has to
|
||||
// be written as a double for this to match on EU.
|
||||
vec3f_set(m->marioObj->header.gfx.scale, 1.8, 0.05f, 1.8f);
|
||||
#ifdef VERSION_SH
|
||||
queue_rumble_data(10, 80);
|
||||
#endif
|
||||
m->actionState = 1;
|
||||
}
|
||||
break;
|
||||
|
@ -1638,9 +1624,7 @@ void stuck_in_ground_handler(struct MarioState *m, s32 animation, s32 unstuckFra
|
|||
if (animFrame == -1) {
|
||||
play_sound_and_spawn_particles(m, SOUND_ACTION_TERRAIN_STUCK_IN_GROUND, 1);
|
||||
} else if (animFrame == unstuckFrame) {
|
||||
#ifdef VERSION_SH
|
||||
queue_rumble_data(5, 80);
|
||||
#endif
|
||||
play_sound_and_spawn_particles(m, SOUND_ACTION_UNSTUCK_FROM_GROUND, 1);
|
||||
} else if (animFrame == target2 || animFrame == target3) {
|
||||
play_mario_landing_sound(m, SOUND_ACTION_TERRAIN_LANDING);
|
||||
|
|
|
@ -1252,9 +1252,8 @@ s32 act_riding_shell_ground(struct MarioState *m) {
|
|||
}
|
||||
|
||||
adjust_sound_for_speed(m);
|
||||
#ifdef VERSION_SH
|
||||
|
||||
reset_rumble_timers();
|
||||
#endif
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -1358,9 +1357,8 @@ s32 act_burning_ground(struct MarioState *m) {
|
|||
}
|
||||
|
||||
m->marioBodyState->eyeState = MARIO_EYES_DEAD;
|
||||
#ifdef VERSION_SH
|
||||
|
||||
reset_rumble_timers();
|
||||
#endif
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -1376,9 +1374,7 @@ void common_slide_action(struct MarioState *m, u32 endAction, u32 airAction, s32
|
|||
vec3f_copy(val14, m->pos);
|
||||
play_sound(SOUND_MOVING_TERRAIN_SLIDE + m->terrainSoundAddend, m->marioObj->header.gfx.cameraToObject);
|
||||
|
||||
#ifdef VERSION_SH
|
||||
reset_rumble_timers();
|
||||
#endif
|
||||
|
||||
adjust_sound_for_speed(m);
|
||||
|
||||
|
@ -1502,9 +1498,7 @@ s32 act_crouch_slide(struct MarioState *m) {
|
|||
|
||||
s32 act_slide_kick_slide(struct MarioState *m) {
|
||||
if (m->input & INPUT_A_PRESSED) {
|
||||
#ifdef VERSION_SH
|
||||
queue_rumble_data(5, 80);
|
||||
#endif
|
||||
return set_jumping_action(m, ACT_FORWARD_ROLLOUT, 0);
|
||||
}
|
||||
|
||||
|
@ -1534,9 +1528,7 @@ s32 act_slide_kick_slide(struct MarioState *m) {
|
|||
s32 stomach_slide_action(struct MarioState *m, u32 stopAction, u32 airAction, s32 animation) {
|
||||
if (m->actionTimer == 5) {
|
||||
if (!(m->input & INPUT_ABOVE_SLIDE) && (m->input & (INPUT_A_PRESSED | INPUT_B_PRESSED))) {
|
||||
#ifdef VERSION_SH
|
||||
queue_rumble_data(5, 80);
|
||||
#endif
|
||||
return drop_and_set_mario_action(
|
||||
m, m->forwardVel >= 0.0f ? ACT_FORWARD_ROLLOUT : ACT_BACKWARD_ROLLOUT, 0);
|
||||
}
|
||||
|
@ -1570,9 +1562,7 @@ s32 act_hold_stomach_slide(struct MarioState *m) {
|
|||
|
||||
s32 act_dive_slide(struct MarioState *m) {
|
||||
if (!(m->input & INPUT_ABOVE_SLIDE) && (m->input & (INPUT_A_PRESSED | INPUT_B_PRESSED))) {
|
||||
#ifdef VERSION_SH
|
||||
queue_rumble_data(5, 80);
|
||||
#endif
|
||||
return set_mario_action(m, m->forwardVel > 0.0f ? ACT_FORWARD_ROLLOUT : ACT_BACKWARD_ROLLOUT,
|
||||
0);
|
||||
}
|
||||
|
@ -1863,7 +1853,7 @@ s32 act_long_jump_land(struct MarioState *m) {
|
|||
m->forwardVel = 0.0f;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
if (!(m->input & INPUT_Z_DOWN)) {
|
||||
m->input &= ~INPUT_A_PRESSED;
|
||||
}
|
||||
|
|
|
@ -265,9 +265,7 @@ s32 act_throwing(struct MarioState *m) {
|
|||
mario_throw_held_object(m);
|
||||
play_sound_if_no_flag(m, SOUND_MARIO_WAH2, MARIO_MARIO_SOUND_PLAYED);
|
||||
play_sound_if_no_flag(m, SOUND_ACTION_THROW, MARIO_ACTION_SOUND_PLAYED);
|
||||
#ifdef VERSION_SH
|
||||
queue_rumble_data(3, 50);
|
||||
#endif
|
||||
}
|
||||
|
||||
animated_stationary_ground_step(m, MARIO_ANIM_GROUND_THROW, ACT_IDLE);
|
||||
|
@ -287,9 +285,7 @@ s32 act_heavy_throw(struct MarioState *m) {
|
|||
mario_drop_held_object(m);
|
||||
play_sound_if_no_flag(m, SOUND_MARIO_WAH2, MARIO_MARIO_SOUND_PLAYED);
|
||||
play_sound_if_no_flag(m, SOUND_ACTION_THROW, MARIO_ACTION_SOUND_PLAYED);
|
||||
#ifdef VERSION_SH
|
||||
queue_rumble_data(3, 50);
|
||||
#endif
|
||||
}
|
||||
|
||||
animated_stationary_ground_step(m, MARIO_ANIM_HEAVY_THROW, ACT_IDLE);
|
||||
|
@ -319,9 +315,7 @@ s32 act_picking_up_bowser(struct MarioState *m) {
|
|||
m->angleVel[1] = 0;
|
||||
m->marioBodyState->grabPos = GRAB_POS_BOWSER;
|
||||
mario_grab_used_object(m);
|
||||
#ifdef VERSION_SH
|
||||
queue_rumble_data(5, 80);
|
||||
#endif
|
||||
play_sound(SOUND_MARIO_HRMM, m->marioObj->header.gfx.cameraToObject);
|
||||
}
|
||||
|
||||
|
@ -397,15 +391,11 @@ s32 act_holding_bowser(struct MarioState *m) {
|
|||
|
||||
// play sound on overflow
|
||||
if (m->angleVel[1] <= -0x100 && spin < m->faceAngle[1]) {
|
||||
#ifdef VERSION_SH
|
||||
queue_rumble_data(4, 20);
|
||||
#endif
|
||||
play_sound(SOUND_OBJ_BOWSER_SPINNING, m->marioObj->header.gfx.cameraToObject);
|
||||
}
|
||||
if (m->angleVel[1] >= 0x100 && spin > m->faceAngle[1]) {
|
||||
#ifdef VERSION_SH
|
||||
queue_rumble_data(4, 20);
|
||||
#endif
|
||||
play_sound(SOUND_OBJ_BOWSER_SPINNING, m->marioObj->header.gfx.cameraToObject);
|
||||
}
|
||||
|
||||
|
@ -422,14 +412,10 @@ s32 act_holding_bowser(struct MarioState *m) {
|
|||
s32 act_releasing_bowser(struct MarioState *m) {
|
||||
if (++m->actionTimer == 1) {
|
||||
if (m->actionArg == 0) {
|
||||
#ifdef VERSION_SH
|
||||
queue_rumble_data(4, 50);
|
||||
#endif
|
||||
mario_throw_held_object(m);
|
||||
} else {
|
||||
#ifdef VERSION_SH
|
||||
queue_rumble_data(4, 50);
|
||||
#endif
|
||||
mario_drop_held_object(m);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -798,16 +798,12 @@ s32 act_shockwave_bounce(struct MarioState *m) {
|
|||
f32 sp18;
|
||||
|
||||
if (m->marioObj->oInteractStatus & 0x10) {
|
||||
#ifdef VERSION_SH
|
||||
queue_rumble_data(70, 40);
|
||||
#endif
|
||||
return hurt_and_set_mario_action(m, ACT_SHOCKED, 0, 4);
|
||||
}
|
||||
|
||||
if (m->actionTimer == 0) {
|
||||
#ifdef VERSION_SH
|
||||
queue_rumble_data(70, 40);
|
||||
#endif
|
||||
if (m->marioObj->oInteractStatus & INT_STATUS_MARIO_UNK1) {
|
||||
return hurt_and_set_mario_action(m, ACT_BACKWARD_GROUND_KB, 0, 0xc);
|
||||
}
|
||||
|
|
|
@ -554,11 +554,9 @@ static s32 act_breaststroke(struct MarioState *m) {
|
|||
reset_float_globals(m);
|
||||
}
|
||||
|
||||
#ifdef VERSION_SH
|
||||
if (m->actionTimer < 6) {
|
||||
func_sh_8024CA04();
|
||||
}
|
||||
#endif
|
||||
|
||||
set_mario_animation(m, MARIO_ANIM_SWIM_PART1);
|
||||
common_swimming_step(m, sSwimStrength);
|
||||
|
@ -802,9 +800,7 @@ static s32 act_water_throw(struct MarioState *m) {
|
|||
|
||||
if (m->actionTimer++ == 5) {
|
||||
mario_throw_held_object(m);
|
||||
#ifdef VERSION_SH
|
||||
queue_rumble_data(3, 50);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (is_anim_at_end(m)) {
|
||||
|
@ -978,11 +974,9 @@ static s32 act_water_plunge(struct MarioState *m) {
|
|||
|
||||
m->particleFlags |= PARTICLE_WATER_SPLASH;
|
||||
m->actionState = 1;
|
||||
#ifdef VERSION_SH
|
||||
if (m->prevAction & ACT_FLAG_AIR) {
|
||||
queue_rumble_data(5, 80);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if (stepResult == WATER_STEP_HIT_FLOOR || m->vel[1] >= endVSpeed || m->actionTimer > 20) {
|
||||
|
@ -1087,10 +1081,8 @@ static s32 act_caught_in_whirlpool(struct MarioState *m) {
|
|||
set_mario_animation(m, MARIO_ANIM_GENERAL_FALL);
|
||||
vec3f_copy(m->marioObj->header.gfx.pos, m->pos);
|
||||
vec3s_set(m->marioObj->header.gfx.angle, 0, m->faceAngle[1], 0);
|
||||
#ifdef VERSION_SH
|
||||
|
||||
reset_rumble_timers();
|
||||
#endif
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
|
@ -116,6 +116,7 @@ static const u8 bindStr[][32] = {
|
|||
{ TEXT_BIND_LEFT },
|
||||
{ TEXT_BIND_RIGHT },
|
||||
{ TEXT_OPT_DEADZONE },
|
||||
{ TEXT_OPT_RUMBLE }
|
||||
};
|
||||
|
||||
static const u8 *filterChoices[] = {
|
||||
|
@ -237,6 +238,7 @@ static struct Option optsControls[] = {
|
|||
// max deadzone is 31000; this is less than the max range of ~32768, but this
|
||||
// way, the player can't accidentally lock themselves out of using the stick
|
||||
DEF_OPT_SCROLL( bindStr[16], &configStickDeadzone, 0, 100, 1 ),
|
||||
DEF_OPT_SCROLL( bindStr[17], &configRumbleStrength, 0, 100, 1)
|
||||
};
|
||||
|
||||
static struct Option optsVideo[] = {
|
||||
|
|
|
@ -103,14 +103,10 @@ static s32 read_eeprom_data(void *buffer, s32 size) {
|
|||
u32 offset = (u32)((u8 *) buffer - (u8 *) &gSaveBuffer) / 8;
|
||||
|
||||
do {
|
||||
#ifdef VERSION_SH
|
||||
block_until_rumble_pak_free();
|
||||
#endif
|
||||
triesLeft--;
|
||||
status = osEepromLongRead(&gSIEventMesgQueue, offset, buffer, size);
|
||||
#ifdef VERSION_SH
|
||||
release_rumble_pak_control();
|
||||
#endif
|
||||
} while (triesLeft > 0 && status != 0);
|
||||
}
|
||||
|
||||
|
@ -131,14 +127,10 @@ static s32 write_eeprom_data(void *buffer, s32 size, const uintptr_t baseofs) {
|
|||
u32 offset = (u32)baseofs >> 3;
|
||||
|
||||
do {
|
||||
#ifdef VERSION_SH
|
||||
block_until_rumble_pak_free();
|
||||
#endif
|
||||
triesLeft--;
|
||||
status = osEepromLongWrite(&gSIEventMesgQueue, offset, buffer, size);
|
||||
#ifdef VERSION_SH
|
||||
release_rumble_pak_control();
|
||||
#endif
|
||||
} while (triesLeft > 0 && status != 0);
|
||||
}
|
||||
|
||||
|
|
|
@ -153,11 +153,10 @@ void play_menu_sounds(s16 soundMenuFlags) {
|
|||
if (soundMenuFlags & 0x100) {
|
||||
play_menu_sounds_extra(20, NULL);
|
||||
}
|
||||
#ifdef VERSION_SH
|
||||
|
||||
if ((soundMenuFlags & 0x20) != 0) {
|
||||
queue_rumble_data(10, 60);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -68,7 +68,7 @@ void cur_obj_play_sound_1(s32 soundMagic) {
|
|||
void cur_obj_play_sound_2(s32 soundMagic) {
|
||||
if (gCurrentObject->header.gfx.node.flags & GRAPH_RENDER_ACTIVE) {
|
||||
play_sound(soundMagic, gCurrentObject->header.gfx.cameraToObject);
|
||||
#ifdef VERSION_SH
|
||||
|
||||
if (soundMagic == SOUND_OBJ_BOWSER_WALK) {
|
||||
queue_rumble_data(3, 60);
|
||||
}
|
||||
|
@ -78,7 +78,6 @@ void cur_obj_play_sound_2(s32 soundMagic) {
|
|||
if (soundMagic == SOUND_OBJ_WHOMP_LOWPRIO) {
|
||||
queue_rumble_data(5, 80);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,8 +5,6 @@
|
|||
#include "main.h"
|
||||
#include "thread6.h"
|
||||
|
||||
#ifdef VERSION_SH
|
||||
|
||||
static s8 D_SH_8030CCB4;
|
||||
static s32 sUnusedDisableRumble;
|
||||
static s32 sRumblePakThreadActive;
|
||||
|
@ -15,22 +13,23 @@ static s32 sRumblePakErrorCount;
|
|||
s32 gRumblePakTimer;
|
||||
|
||||
// These void* are OSPfs* but we don't have that header
|
||||
// And in general, it is not necessary =)
|
||||
extern s32 osMotorStop(void *);
|
||||
extern s32 osMotorStart(void *);
|
||||
extern u32 osMotorInit(OSMesgQueue *, void *, s32);
|
||||
|
||||
void init_rumble_pak_scheduler_queue(void) {
|
||||
osCreateMesgQueue(&gRumblePakSchedulerMesgQueue, gRumblePakSchedulerMesgBuf, 1);
|
||||
osSendMesg(&gRumblePakSchedulerMesgQueue, (OSMesg) 0, OS_MESG_NOBLOCK);
|
||||
// osCreateMesgQueue(&gRumblePakSchedulerMesgQueue, gRumblePakSchedulerMesgBuf, 1);
|
||||
// osSendMesg(&gRumblePakSchedulerMesgQueue, (OSMesg) 0, OS_MESG_NOBLOCK);
|
||||
}
|
||||
|
||||
void block_until_rumble_pak_free(void) {
|
||||
OSMesg msg;
|
||||
osRecvMesg(&gRumblePakSchedulerMesgQueue, &msg, OS_MESG_BLOCK);
|
||||
// OSMesg msg;
|
||||
// osRecvMesg(&gRumblePakSchedulerMesgQueue, &msg, OS_MESG_BLOCK);
|
||||
}
|
||||
|
||||
void release_rumble_pak_control(void) {
|
||||
osSendMesg(&gRumblePakSchedulerMesgQueue, (OSMesg) 0, OS_MESG_NOBLOCK);
|
||||
// osSendMesg(&gRumblePakSchedulerMesgQueue, (OSMesg) 0, OS_MESG_NOBLOCK);
|
||||
}
|
||||
|
||||
static void start_rumble(void) {
|
||||
|
@ -225,32 +224,24 @@ void func_sh_8024CA04(void) {
|
|||
gCurrRumbleSettings.unk0C = 4;
|
||||
}
|
||||
|
||||
static void thread6_rumble_loop(UNUSED void *a0) {
|
||||
OSMesg msg;
|
||||
void thread6_rumble_loop(UNUSED void *a0) {
|
||||
// OSMesg msg;
|
||||
// osRecvMesg(&gRumbleThreadVIMesgQueue, &msg, OS_MESG_BLOCK);
|
||||
|
||||
cancel_rumble();
|
||||
update_rumble_data_queue();
|
||||
update_rumble_pak();
|
||||
|
||||
sRumblePakThreadActive = TRUE;
|
||||
|
||||
while (TRUE) {
|
||||
// Block until VI
|
||||
osRecvMesg(&gRumbleThreadVIMesgQueue, &msg, OS_MESG_BLOCK);
|
||||
|
||||
update_rumble_data_queue();
|
||||
update_rumble_pak();
|
||||
|
||||
if (sRumblePakActive) {
|
||||
if (sRumblePakErrorCount >= 30) {
|
||||
sRumblePakActive = FALSE;
|
||||
}
|
||||
} else if (gGlobalTimer % 60 == 0) {
|
||||
sRumblePakActive = osMotorInit(&gSIEventMesgQueue, &gRumblePakPfs, gPlayer1Controller->port) < 1;
|
||||
sRumblePakErrorCount = 0;
|
||||
if (sRumblePakActive) {
|
||||
if (sRumblePakErrorCount >= 30) {
|
||||
sRumblePakActive = FALSE;
|
||||
}
|
||||
} else if (gGlobalTimer % 60 == 0) {
|
||||
sRumblePakActive = osMotorInit(&gSIEventMesgQueue, &gRumblePakPfs, gPlayer1Controller->port) < 1;
|
||||
sRumblePakErrorCount = 0;
|
||||
}
|
||||
|
||||
if (gRumblePakTimer > 0) {
|
||||
gRumblePakTimer--;
|
||||
}
|
||||
if (gRumblePakTimer > 0) {
|
||||
gRumblePakTimer--;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -272,9 +263,9 @@ void cancel_rumble(void) {
|
|||
}
|
||||
|
||||
void create_thread_6(void) {
|
||||
osCreateMesgQueue(&gRumbleThreadVIMesgQueue, gRumbleThreadVIMesgBuf, 1);
|
||||
osCreateThread(&gRumblePakThread, 6, thread6_rumble_loop, NULL, gThread6Stack + 0x2000, 30);
|
||||
osStartThread(&gRumblePakThread);
|
||||
// osCreateMesgQueue(&gRumbleThreadVIMesgQueue, gRumbleThreadVIMesgBuf, 1);
|
||||
// osCreateThread(&gRumblePakThread, 6, thread6_rumble_loop, NULL, gThread6Stack + 0x2000, 30);
|
||||
// osStartThread(&gRumblePakThread);
|
||||
}
|
||||
|
||||
void rumble_thread_update_vi(void) {
|
||||
|
@ -282,7 +273,5 @@ void rumble_thread_update_vi(void) {
|
|||
return;
|
||||
}
|
||||
|
||||
osSendMesg(&gRumbleThreadVIMesgQueue, (OSMesg) 0x56525443, OS_MESG_NOBLOCK);
|
||||
}
|
||||
|
||||
#endif
|
||||
// osSendMesg(&gRumbleThreadVIMesgQueue, (OSMesg) 0x56525443, OS_MESG_NOBLOCK);
|
||||
}
|
|
@ -1,8 +1,6 @@
|
|||
#ifndef _THREAD_6_H
|
||||
#define _THREAD_6_H
|
||||
|
||||
#ifdef VERSION_SH
|
||||
|
||||
extern s32 gRumblePakTimer;
|
||||
|
||||
extern void init_rumble_pak_scheduler_queue(void);
|
||||
|
@ -18,6 +16,4 @@ extern void cancel_rumble(void);
|
|||
extern void create_thread_6(void);
|
||||
extern void rumble_thread_update_vi(void);
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif // _THREAD_6_H
|
|
@ -67,6 +67,7 @@ unsigned int configKeyStickDown[MAX_BINDS] = { 0x001F, VK_INVALID, VK_INVALID
|
|||
unsigned int configKeyStickLeft[MAX_BINDS] = { 0x001E, VK_INVALID, VK_INVALID };
|
||||
unsigned int configKeyStickRight[MAX_BINDS] = { 0x0020, VK_INVALID, VK_INVALID };
|
||||
unsigned int configStickDeadzone = 16; // 16*DEADZONE_STEP=4960 (the original default deadzone)
|
||||
unsigned int configRumbleStrength = 50;
|
||||
#ifdef EXTERNAL_DATA
|
||||
bool configPrecacheRes = true;
|
||||
#endif
|
||||
|
@ -109,6 +110,7 @@ static const struct ConfigOption options[] = {
|
|||
{.name = "key_stickleft", .type = CONFIG_TYPE_BIND, .uintValue = configKeyStickLeft},
|
||||
{.name = "key_stickright", .type = CONFIG_TYPE_BIND, .uintValue = configKeyStickRight},
|
||||
{.name = "stick_deadzone", .type = CONFIG_TYPE_UINT, .uintValue = &configStickDeadzone},
|
||||
{.name = "rumble_strength", .type = CONFIG_TYPE_UINT, .uintValue = &configRumbleStrength},
|
||||
#ifdef EXTERNAL_DATA
|
||||
{.name = "precache", .type = CONFIG_TYPE_BOOL, .boolValue = &configPrecacheRes},
|
||||
#endif
|
||||
|
|
|
@ -36,6 +36,7 @@ extern unsigned int configKeyStickDown[];
|
|||
extern unsigned int configKeyStickLeft[];
|
||||
extern unsigned int configKeyStickRight[];
|
||||
extern unsigned int configStickDeadzone;
|
||||
extern unsigned int configRumbleStrength;
|
||||
#ifdef EXTERNAL_DATA
|
||||
extern bool configPrecacheRes;
|
||||
#endif
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
|
||||
#include "controller_recorded_tas.h"
|
||||
#include "controller_keyboard.h"
|
||||
|
||||
#include "controller_sdl.h"
|
||||
|
||||
// Analog camera movement by Pathétique (github.com/vrmiguel), y0shin and Mors
|
||||
|
@ -30,6 +29,19 @@ s32 osContInit(OSMesgQueue *mq, u8 *controllerBits, OSContStatus *status) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
s32 osMotorStart(void *pfs) {
|
||||
// Since rumble stops by osMotorStop, its duration is not nessecary.
|
||||
return controller_rumble_play(configRumbleStrength / 100.0, 50);
|
||||
}
|
||||
|
||||
s32 osMotorStop(void *pfs) {
|
||||
return controller_rumble_stop();
|
||||
}
|
||||
|
||||
u32 osMotorInit(OSMesgQueue *mq, void *pfs, s32 port) {
|
||||
return controller_rumble_init();
|
||||
}
|
||||
|
||||
s32 osContStartReadData(OSMesgQueue *mesg) {
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -35,6 +35,7 @@ extern u8 newcam_mouse;
|
|||
|
||||
static bool init_ok;
|
||||
static SDL_GameController *sdl_cntrl;
|
||||
static SDL_Haptic *sdl_haptic;
|
||||
|
||||
static u32 num_joy_binds = 0;
|
||||
static u32 num_mouse_binds = 0;
|
||||
|
@ -85,7 +86,7 @@ static void controller_sdl_bind(void) {
|
|||
}
|
||||
|
||||
static void controller_sdl_init(void) {
|
||||
if (SDL_Init(SDL_INIT_GAMECONTROLLER | SDL_INIT_EVENTS) != 0) {
|
||||
if (SDL_Init(SDL_INIT_GAMECONTROLLER | SDL_INIT_EVENTS | SDL_INIT_HAPTIC) != 0) {
|
||||
fprintf(stderr, "SDL init error: %s\n", SDL_GetError());
|
||||
return;
|
||||
}
|
||||
|
@ -144,6 +145,7 @@ static void controller_sdl_read(OSContPad *pad) {
|
|||
for (int i = 0; i < SDL_NumJoysticks(); i++) {
|
||||
if (SDL_IsGameController(i)) {
|
||||
sdl_cntrl = SDL_GameControllerOpen(i);
|
||||
sdl_haptic = SDL_HapticOpen(i);
|
||||
if (sdl_cntrl != NULL) {
|
||||
break;
|
||||
}
|
||||
|
@ -241,11 +243,46 @@ static void controller_sdl_shutdown(void) {
|
|||
SDL_GameControllerClose(sdl_cntrl);
|
||||
sdl_cntrl = NULL;
|
||||
}
|
||||
if (sdl_haptic) {
|
||||
SDL_HapticClose(sdl_haptic);
|
||||
sdl_haptic = NULL;
|
||||
}
|
||||
SDL_QuitSubSystem(SDL_INIT_GAMECONTROLLER);
|
||||
}
|
||||
init_ok = false;
|
||||
}
|
||||
|
||||
u32 controller_rumble_init(void) {
|
||||
if (SDL_HapticRumbleSupported(sdl_haptic) != SDL_TRUE) {
|
||||
// printf("Controller does not support haptics! %s\n", SDL_GetError());
|
||||
return 1;
|
||||
}
|
||||
if (SDL_HapticRumbleInit(sdl_haptic) != 0) {
|
||||
printf("Unable to initialize rumble! %s\n", SDL_GetError());
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
s32 controller_rumble_play(f32 strength, u32 length) {
|
||||
if (SDL_HapticRumblePlay(sdl_haptic, strength, length) != 0) {
|
||||
printf("Unable to start rumble! %s\n", SDL_GetError());
|
||||
return -1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
s32 controller_rumble_stop(void) {
|
||||
if (SDL_HapticRumbleStop(sdl_haptic) != 0) {
|
||||
printf("Unable to stop rumble! %s\n", SDL_GetError());
|
||||
return -1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
struct ControllerAPI controller_sdl = {
|
||||
VK_BASE_SDL_GAMEPAD,
|
||||
controller_sdl_init,
|
||||
|
|
|
@ -7,4 +7,8 @@
|
|||
|
||||
extern struct ControllerAPI controller_sdl;
|
||||
|
||||
u32 controller_rumble_init(void);
|
||||
s32 controller_rumble_play(f32 strength, u32 length);
|
||||
s32 controller_rumble_stop(void);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -23,6 +23,9 @@
|
|||
#include "configfile.h"
|
||||
#include "controller/controller_api.h"
|
||||
|
||||
#include "game/main.h"
|
||||
#include "game/thread6.h"
|
||||
|
||||
OSMesg D_80339BEC;
|
||||
OSMesgQueue gSIEventMesgQueue;
|
||||
|
||||
|
@ -32,6 +35,10 @@ s8 gDebugLevelSelect;
|
|||
s8 gShowProfiler;
|
||||
s8 gShowDebugText;
|
||||
|
||||
s32 gRumblePakPfs;
|
||||
struct RumbleData gRumbleDataQueue[3];
|
||||
struct StructSH8031D9B0 gCurrRumbleSettings;
|
||||
|
||||
static struct AudioAPI *audio_api;
|
||||
static struct GfxWindowManagerAPI *wm_api;
|
||||
static struct GfxRenderingAPI *rendering_api;
|
||||
|
@ -60,6 +67,7 @@ void send_display_list(struct SPTask *spTask) {
|
|||
void produce_one_frame(void) {
|
||||
gfx_start_frame();
|
||||
game_loop_one_iteration();
|
||||
thread6_rumble_loop();
|
||||
|
||||
int samples_left = audio_api->buffered();
|
||||
u32 num_audio_samples = samples_left < audio_api->get_desired_buffered() ? 544 : 528;
|
||||
|
@ -162,7 +170,7 @@ void main_func(void) {
|
|||
sound_init();
|
||||
|
||||
thread5_game_loop(NULL);
|
||||
|
||||
|
||||
inited = true;
|
||||
|
||||
#ifdef TARGET_WEB
|
||||
|
|
Loading…
Reference in a new issue