Skip to content

Commit

Permalink
add 'partial handshake' anim
Browse files Browse the repository at this point in the history
seen at the end of the mission "Catalyst"
  • Loading branch information
headshot2017 committed Feb 23, 2024
1 parent 40619aa commit 9b5c588
Show file tree
Hide file tree
Showing 6 changed files with 254 additions and 41 deletions.
20 changes: 20 additions & 0 deletions mario_cj_anims.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
#include <functional>
#include <utility>

#include "plugin.h"
#include "CHud.h"
extern "C" {
#include <decomp/include/sm64shared.h>
}
Expand Down Expand Up @@ -49,6 +51,15 @@ void runAnimKey(CTaskSimpleRunNamedAnim* task, const int& marioId)
(cjAnimKeys.count(task->m_animGroupName)) ? task->m_animGroupName :
"";

#ifdef _DEBUG
if (plugin::KeyPressed(VK_MULTIPLY))
{
char buf[256];
sprintf(buf, "%d '%s' '%s'", task->m_nAnimId, task->m_animName, task->m_animGroupName);
CHud::SetMessage(buf);
}
#endif

runAnimKey(key, marioId);
}

Expand Down Expand Up @@ -265,6 +276,14 @@ void animHandshake(const int& marioId)
sm64_set_mario_animation(marioId, MARIO_ANIM_CUSTOM_HANDSHAKE);
}

void animPartialHandshake1(const int& marioId)
{
// seen at the end of the mission "Catalyst", when Ryder says "For life, CJ"
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_PARTIAL_HANDSHAKE);
}

void animDanceLoop(const int& marioId)
{
sm64_set_mario_action_arg(marioId, ACT_CUSTOM_ANIM, 1);
Expand Down Expand Up @@ -361,6 +380,7 @@ std::unordered_map<std::string, ConvertedAnim> cjAnimKeys =
{"PLYR_SHKHEAD", {animPlayerShakeHead, false}},
{"LAUGH_01", {animLaugh01, false}},
{"HNDSHKFA", {animHandshake, false}},
{"PRTIAL_HNDSHK_01", {animPartialHandshake1, false}},
{"DANCE_LOOP", {animDanceLoop, false}},
{"DANCE_G1", {animDanceGood, false}},
{"DANCE_G2", {animDanceGood, false}},
Expand Down
3 changes: 3 additions & 0 deletions mario_custom_anims.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "raw/anim_facepalm.raw.h"
#include "raw/anim_laugh01.raw.h"
#include "raw/anim_handshake.raw.h"
#include "raw/anim_partial_handshake.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 @@ -88,6 +89,7 @@ int MARIO_ANIM_CUSTOM_CRIB_SWITCH;
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_DANCE_LOOP;
int MARIO_ANIM_CUSTOM_DANCE_BAD;
int MARIO_ANIM_CUSTOM_DANCE_GOOD;
Expand Down Expand Up @@ -167,6 +169,7 @@ void marioInitCustomAnims()
MARIO_ANIM_CUSTOM_FACEPALM = sm64_custom_animation_init(marioAnimFacepalmRaw, marioAnimFacepalmRaw_length);
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_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
1 change: 1 addition & 0 deletions mario_custom_anims.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ extern int MARIO_ANIM_CUSTOM_CRIB_SWITCH;
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_DANCE_LOOP;
extern int MARIO_ANIM_CUSTOM_DANCE_BAD;
extern int MARIO_ANIM_CUSTOM_DANCE_GOOD;
Expand Down
73 changes: 32 additions & 41 deletions mario_ped_tasks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -434,16 +434,6 @@ void marioPedTasks(CPlayerPed* ped, const int& marioId)
else if ((baseTask = ped->m_pIntelligence->m_TaskMgr.FindActiveTaskByType(TASK_SIMPLE_NAMED_ANIM)))
{
CTaskSimpleRunNamedAnim* task = static_cast<CTaskSimpleRunNamedAnim*>(baseTask);

#ifdef _DEBUG
if (plugin::KeyPressed(VK_MULTIPLY))
{
char buf[256];
sprintf(buf, "%d '%s' '%s'", task->m_nAnimId, task->m_animName, task->m_animGroupName);
CHud::SetMessage(buf);
}
#endif

runAnimKey(task, marioId);
}
else if ((baseTask = ped->m_pIntelligence->m_TaskMgr.FindActiveTaskByType(TASK_COMPLEX_USE_SEQUENCE)))
Expand All @@ -459,6 +449,7 @@ void marioPedTasks(CPlayerPed* ped, const int& marioId)
CTaskComplexSequence2* sub2 = static_cast<CTaskComplexSequence2*>(sub);
CTask* sub2_aTask = sub2->m_aTasks[sub2->m_nCurrentTaskIndex];
eTaskType aTaskID = ((eTaskType (__thiscall *)(CTask *))plugin::GetVMT(sub2_aTask, 4))(sub2_aTask);

if (aTaskID == TASK_SIMPLE_SLIDE_TO_COORD)
{
// class CTaskSimpleSlideToCoord : public CTaskSimpleRunNamedAnim
Expand Down Expand Up @@ -508,37 +499,6 @@ void marioPedTasks(CPlayerPed* ped, const int& marioId)
_fallen = false;
resetLastAnim();
}

/*
char buf[256] = {0};
char a[32];
for (int i=0; i<TASK_PRIMARY_MAX; i++)
{
sprintf(a, (ped->m_pIntelligence->m_TaskMgr.m_aPrimaryTasks[i]) ? "%x" : "%x ", ped->m_pIntelligence->m_TaskMgr.m_aPrimaryTasks[i]);
strcat(buf, a);
if (ped->m_pIntelligence->m_TaskMgr.m_aPrimaryTasks[i])
{
CTask* task = ped->m_pIntelligence->m_TaskMgr.m_aPrimaryTasks[i];
eTaskType taskID = ((eTaskType (__thiscall *)(CTask *))plugin::GetVMT(task, 4))(task);
sprintf(a, "(%d) ", taskID);
strcat(buf, a);
}
}
strcat(buf, "- ");
for (int i=0; i<TASK_SECONDARY_MAX; i++)
{
sprintf(a, (i == TASK_SECONDARY_MAX-1 || ped->m_pIntelligence->m_TaskMgr.m_aSecondaryTasks[i]) ? "%x" : "%x ", ped->m_pIntelligence->m_TaskMgr.m_aSecondaryTasks[i]);
strcat(buf, a);
if (ped->m_pIntelligence->m_TaskMgr.m_aSecondaryTasks[i])
{
CTask* task = ped->m_pIntelligence->m_TaskMgr.m_aSecondaryTasks[i];
eTaskType taskID = ((eTaskType (__thiscall *)(CTask *))plugin::GetVMT(task, 4))(task);
sprintf(a, (i == TASK_SECONDARY_MAX-1) ? "(%d)" : "(%d) ", taskID);
strcat(buf, a);
}
}
CHud::SetMessage(buf);
*/
}

void marioPedTasksMaxFPS(CPlayerPed* ped, const int& marioId)
Expand Down Expand Up @@ -738,4 +698,35 @@ void marioPedTasksMaxFPS(CPlayerPed* ped, const int& marioId)
//char buf[32];
//sprintf(buf, "%d %d %d", marioState.animInfo.animOverride.current, marioState.actionState, marioState.animInfo.animFrame);
//CHud::SetMessage(buf);

/*
char buf[256] = {0};
char a[32];
for (int i=0; i<TASK_PRIMARY_MAX; i++)
{
sprintf(a, (ped->m_pIntelligence->m_TaskMgr.m_aPrimaryTasks[i]) ? "%x" : "%x ", ped->m_pIntelligence->m_TaskMgr.m_aPrimaryTasks[i]);
strcat(buf, a);
if (ped->m_pIntelligence->m_TaskMgr.m_aPrimaryTasks[i])
{
CTask* task = ped->m_pIntelligence->m_TaskMgr.m_aPrimaryTasks[i];
eTaskType taskID = ((eTaskType (__thiscall *)(CTask *))plugin::GetVMT(task, 4))(task);
sprintf(a, "(%d) ", taskID);
strcat(buf, a);
}
}
strcat(buf, "- ");
for (int i=0; i<TASK_SECONDARY_MAX; i++)
{
sprintf(a, (i == TASK_SECONDARY_MAX-1 || ped->m_pIntelligence->m_TaskMgr.m_aSecondaryTasks[i]) ? "%x" : "%x ", ped->m_pIntelligence->m_TaskMgr.m_aSecondaryTasks[i]);
strcat(buf, a);
if (ped->m_pIntelligence->m_TaskMgr.m_aSecondaryTasks[i])
{
CTask* task = ped->m_pIntelligence->m_TaskMgr.m_aSecondaryTasks[i];
eTaskType taskID = ((eTaskType (__thiscall *)(CTask *))plugin::GetVMT(task, 4))(task);
sprintf(a, (i == TASK_SECONDARY_MAX-1) ? "(%d)" : "(%d) ", taskID);
strcat(buf, a);
}
}
CHud::SetMessage(buf);
*/
}
Loading

0 comments on commit 9b5c588

Please sign in to comment.