Skip to content

Commit

Permalink
add animations for Reuniting the Families
Browse files Browse the repository at this point in the history
* when arriving at the motel, Mario will look to his right when talking to the homies
* at the end of the mission, added a custom animation of Mario getting up after jumping out of the car
  • Loading branch information
headshot2017 committed Mar 3, 2024
1 parent 9b5c588 commit 5eaaff1
Show file tree
Hide file tree
Showing 8 changed files with 1,648 additions and 4 deletions.
11 changes: 9 additions & 2 deletions mario.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,9 @@ uint32_t elapsedTicks = 0;
uint32_t safeTicks = 0;
int marioId = -1;
float ticks = 0;
static float headAngle[2] = {0};
float headAngle[2] = {0};
float headAngleTarget[2] = {0};
bool overrideHeadAngle = false;


uint8_t* EulerIndices1 = (uint8_t*)0x866D9C;
Expand Down Expand Up @@ -1187,9 +1189,9 @@ void marioTick(float dt)
}

// Mario head rotation
float headAngleTarget[2] = {0};
if (ped->m_pIntelligence->m_TaskMgr.m_aSecondaryTasks[TASK_SECONDARY_IK])
{
overrideHeadAngle = true;
CTaskSimpleIKManager* task = static_cast<CTaskSimpleIKManager*>(ped->m_pIntelligence->m_TaskMgr.m_aSecondaryTasks[TASK_SECONDARY_IK]);
CTaskSimpleIKLookAt* lookAt = static_cast<CTaskSimpleIKLookAt*>(task->m_pIKChainTasks[0]);

Expand Down Expand Up @@ -1227,6 +1229,11 @@ void marioTick(float dt)
}
}
}
else if (!ped->m_pIntelligence->m_TaskMgr.FindActiveTaskByType(TASK_SIMPLE_NAMED_ANIM) && !ped->m_pIntelligence->m_TaskMgr.m_aSecondaryTasks[TASK_SECONDARY_IK])
overrideHeadAngle = false;

if (!overrideHeadAngle)
for (int i=0; i<2; i++) headAngleTarget[i] = 0;

if (!CCutsceneMgr::ms_running)
{
Expand Down
3 changes: 3 additions & 0 deletions mario.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ extern SM64MarioState marioState;
extern SM64MarioGeometryBuffers marioGeometry;
extern CVector marioInterpPos;

extern float headAngleTarget[2];
extern bool overrideHeadAngle;

bool removeObject(CEntity* ent);

bool marioSpawned();
Expand Down
26 changes: 24 additions & 2 deletions mario_cj_anims.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,12 +237,29 @@ void animJustBusiness(const int& marioId)

void animReunitingFamiliesEnd1(const int& marioId)
{
// animation after finishing "Reuniting the Families"
// animation after finishing "Reuniting the Families" (part 1)
sm64_set_mario_action_arg(marioId, ACT_CUSTOM_ANIM, 1);
sm64_set_mario_animation(marioId, MARIO_ANIM_CUSTOM_REUNITING_FAM_END1);
}

void animReunitingFamiliesEnd2(const int& marioId)
{
// animation after finishing "Reuniting the Families"
// animation after finishing "Reuniting the Families" (part 2)
sm64_set_mario_action_arg(marioId, ACT_CUSTOM_ANIM_TO_ACTION, 1);
sm64_set_mario_action_arg2(marioId, ACT_IDLE);
sm64_set_mario_animation(marioId, MARIO_ANIM_CUSTOM_REUNITING_FAM_END2);
}

void animResetHeadRotation(const int& marioId)
{
overrideHeadAngle = false;
}

void animRotateHeadRight(const int& marioId)
{
overrideHeadAngle = true;
headAngleTarget[0] = 0;
headAngleTarget[1] = -M_PI_2;
}

void animCribUseSwitch(const int& marioId)
Expand Down Expand Up @@ -372,8 +389,13 @@ std::unordered_map<std::string, ConvertedAnim> cjAnimKeys =

// missions
{"JST_BUISNESS", {animJustBusiness, false}},
{"CAR_SC1_FL", {animRotateHeadRight, false}},
{"CAR_SC2_FL", {animResetHeadRotation, false}},
{"CAR_SC3_FL", {animRotateHeadRight, false}},
{"END_SC1_PLY", {animReunitingFamiliesEnd1, false}},
{"END_SC2_PLY", {animReunitingFamiliesEnd2, false}},
{"GDB_CAR_PLY", {animRotateHeadRight, false}},
{"GDB_CAR2_PLY", {animRotateHeadRight, false}},

// misc
{"CRIB_USE_SWITCH", {animCribUseSwitch, false}},
Expand Down
6 changes: 6 additions & 0 deletions mario_custom_anims.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
#include "raw/anim_laugh01.raw.h"
#include "raw/anim_handshake.raw.h"
#include "raw/anim_partial_handshake.raw.h"
#include "raw/anim_reuniting_families_end1.raw.h"
#include "raw/anim_reuniting_families_end2.raw.h"
#include "raw/anim_dance_loop.raw.h"
#include "raw/anim_dance_bad.raw.h"
#include "raw/anim_dance_good.raw.h"
Expand Down Expand Up @@ -90,6 +92,8 @@ int MARIO_ANIM_CUSTOM_FACEPALM;
int MARIO_ANIM_CUSTOM_LAUGH01;
int MARIO_ANIM_CUSTOM_HANDSHAKE;
int MARIO_ANIM_CUSTOM_PARTIAL_HANDSHAKE;
int MARIO_ANIM_CUSTOM_REUNITING_FAM_END1;
int MARIO_ANIM_CUSTOM_REUNITING_FAM_END2;
int MARIO_ANIM_CUSTOM_DANCE_LOOP;
int MARIO_ANIM_CUSTOM_DANCE_BAD;
int MARIO_ANIM_CUSTOM_DANCE_GOOD;
Expand Down Expand Up @@ -170,6 +174,8 @@ void marioInitCustomAnims()
MARIO_ANIM_CUSTOM_LAUGH01 = sm64_custom_animation_init(marioAnimLaugh01Raw, marioAnimLaugh01Raw_length);
MARIO_ANIM_CUSTOM_HANDSHAKE = sm64_custom_animation_init(marioAnimHandshakeRaw, marioAnimHandshakeRaw_length);
MARIO_ANIM_CUSTOM_PARTIAL_HANDSHAKE = sm64_custom_animation_init(marioAnimPartialHandshakeRaw, marioAnimPartialHandshakeRaw_length);
MARIO_ANIM_CUSTOM_REUNITING_FAM_END1 = sm64_custom_animation_init(marioAnimReunitingFamiliesEnd1Raw, marioAnimReunitingFamiliesEnd1Raw_length);
MARIO_ANIM_CUSTOM_REUNITING_FAM_END2 = sm64_custom_animation_init(marioAnimReunitingFamiliesEnd2Raw, marioAnimReunitingFamiliesEnd2Raw_length);
MARIO_ANIM_CUSTOM_DANCE_LOOP = sm64_custom_animation_init(marioAnimDanceLoopRaw, marioAnimDanceLoopRaw_length);
MARIO_ANIM_CUSTOM_DANCE_BAD = sm64_custom_animation_init(marioAnimDanceBadRaw, marioAnimDanceBadRaw_length);
MARIO_ANIM_CUSTOM_DANCE_GOOD = sm64_custom_animation_init(marioAnimDanceGoodRaw, marioAnimDanceGoodRaw_length);
Expand Down
2 changes: 2 additions & 0 deletions mario_custom_anims.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ extern int MARIO_ANIM_CUSTOM_FACEPALM;
extern int MARIO_ANIM_CUSTOM_LAUGH01;
extern int MARIO_ANIM_CUSTOM_HANDSHAKE;
extern int MARIO_ANIM_CUSTOM_PARTIAL_HANDSHAKE;
extern int MARIO_ANIM_CUSTOM_REUNITING_FAM_END1;
extern int MARIO_ANIM_CUSTOM_REUNITING_FAM_END2;
extern int MARIO_ANIM_CUSTOM_DANCE_LOOP;
extern int MARIO_ANIM_CUSTOM_DANCE_BAD;
extern int MARIO_ANIM_CUSTOM_DANCE_GOOD;
Expand Down
Loading

0 comments on commit 5eaaff1

Please sign in to comment.