VehTalkMask

This commit is contained in:
Niko 2024-03-14 21:59:50 -04:00
parent 2c235cbf47
commit a7c261dcbd
9 changed files with 182 additions and 6 deletions

View File

@ -0,0 +1,10 @@
#include <common.h>
void DECOMP_VehTalkMask_End()
{
sdata->boolIsMaskThreadAlive = 0;
sdata->talkMask_boolDead = 1;
// optimization, end function on JMP
DECOMP_CDSYS_XAPauseRequest();
}

View File

@ -0,0 +1,19 @@
#include <common.h>
void DECOMP_VehTalkMask_ThTick(struct Thread* t);
struct Instance* DECOMP_VehTalkMask_Init()
{
struct Instance* mhInst =
INSTANCE_BirthWithThread(
0x39, 0, SMALL, AKUAKU,
DECOMP_VehTalkMask_ThTick,
sizeof(struct MaskHint), 0);
struct Thread* mhTh = mhInst->thread;
mhTh->funcThDestroy = THREAD_DestroyInstance;
((struct MaskHint*)mhTh->object)->scale = 0;
return mhInst;
}

View File

@ -0,0 +1,17 @@
#include <common.h>
void DECOMP_VehTalkMask_PlayXA(struct INSTANCE* i, int id)
{
struct Driver* d = sdata->gGT->drivers[0];
if(d != 0)
{
int boolGoodGuy =
DECOMP_VehPickupItem_MaskBoolGoodGuy(d);
if(boolGoodGuy == 0)
id += 0x1f;
}
DECOMP_CDSYS_XAPlay(CDSYS_XA_TYPE_EXTRA, id);
}

View File

@ -0,0 +1,116 @@
#include <common.h>
void DECOMP_VehTalkMask_ThTick(struct Thread* t)
{
struct GameTracker* gGT = sdata->gGT;
struct MaskHint* mhObj = t->object;
struct Instance* mhInst = t->inst;
int scale = mhObj->scale;
if(sdata->modelMaskHints3D != 0)
{
mhInst->model = sdata->modelMaskHints3D;
scale *= 2;
}
else
{
// do we need this IF ???
if(gGT->drivers[0] != 0)
{
int boolGoodGuy =
DECOMP_VehPickupItem_MaskBoolGoodGuy(gGT->drivers[0]);
// 0x3A for Uka, 0x39 for Aku
int modelID = 0x3A - boolGoodGuy;
mhInst->model = gGT->modelPtr[modelID];
}
}
mhInst->scale[0] = scale;
mhInst->scale[1] = scale;
mhInst->scale[2] = scale;
sdata->unk_8008d9f4[1] = sdata->XA_MaxSampleValInArr;
int iVar4 = sdata->unk_8008d9f4[1] * 7;
if (iVar4 < 0) {
iVar4 = iVar4 + 0x3fff;
}
iVar4 = iVar4 >> 0xe;
if (sdata->unk_8008d9f4[2] < iVar4)
sdata->unk_8008d9f4[2] = iVar4;
int iVar6 = iVar4;
if (iVar4 < 2) {
iVar6 = 0;
}
int iVar5 = mhInst->animFrame;
if (iVar4 > 3)
{
iVar4 = iVar5 - iVar6;
if (iVar4 < 0) {
iVar4 = -iVar4;
}
if (iVar4 > 3)
{
mhInst->animFrame = (short)iVar6;
goto SkipLerp;
}
}
mhInst->animFrame =
EngineSound_VolumeAdjust(iVar6,iVar5,1);
SkipLerp:
iVar5 = mhInst->animFrame;
// animFrame
iVar4 = iVar5 - iVar6;
if (iVar4 < 0) {
iVar4 = -iVar4;
}
if (iVar4 < 6)
{
mhInst->animFrame =
EngineSound_VolumeAdjust(iVar6,iVar5,1);
}
else
{
mhInst->animFrame = (short)iVar6;
}
// animation frame goes back and forth
// 0x00: mouth close
// 0x0C: mouth open
int lastFrame =
VehFrameInst_GetNumAnimFrames(mhInst,0) - 1;
if (mhInst->animFrame < 0)
mhInst->animFrame = 0;
else if (lastFrame < mhInst->animFrame)
mhInst->animFrame = lastFrame;
if (sdata->talkMask_boolDead != 0)
{
sdata->talkMask_boolDead = 0;
// dead thread
t->flags |= 0x800;
}
}

View File

@ -0,0 +1,6 @@
#include <common.h>
int DECOMP_VehTalkMask_boolNoXA()
{
return sdata->XA_State == 0;
}

View File

@ -690,7 +690,11 @@ common, exe, VehStuckProc_Tumble_Init, 0x0, General/Vehicle/VehStuckProc_Tumble_
// need VehStuckProc_Warp
// need VehTalkMask
//ommon, exe, VehTalkMask_ThTick, 0x0, General/Vehicle/VehTalkMask_ThTick.c
common, exe, VehTalkMask_ThTick, 0x0, General/Vehicle/VehTalkMask_ThTick.c
common, exe, VehTalkMask_Init, 0x0, General/Vehicle/VehTalkMask_Init.c
common, exe, VehTalkMask_PlayXA, 0x0, General/Vehicle/VehTalkMask_PlayXA.c
common, exe, VehTalkMask_boolNoXA, 0x0, General/Vehicle/VehTalkMask_boolNoXA.c
common, exe, VehTalkMask_End, 0x0, General/Vehicle/VehTalkMask_End.c
// need VehTurbo_ProcessBucket (in wip)
common, exe, VehTurbo_ThTick, 0x0, General/Vehicle/VehTurbo_ThTick.c

View File

@ -35742,10 +35742,10 @@ void FUN_8006925c(void)
// CDSYS_XAPauseRequest
FUN_8001cf98();
// mask is not talking (I think)
// sdata->boolIsMaskThreadAlive
DAT_8008d65c = 0;
// talking mask needs to go away
// sdata->talkMask_boolDead
DAT_8008da00 = 1;
return;

View File

@ -3424,6 +3424,7 @@ struct sData
char s_tnt1[8];
char s_beaker1[8];
// 8008d660
int boolIsMaskThreadAlive;
// 8008d660
@ -4321,10 +4322,13 @@ struct sData
// 8008d9f4
// force of driver bounce?
int unk_bothIn94426_C_file[3];
int unk_8008d9f4[3];
// 8008d9f8 and 8008d9fc,
// both talkMask variables
// 8008da00
int bool_shouldTalkingMaskDisappear;
int talkMask_boolDead;
// 8008da04
// return address, from entry() back to bios,

View File

@ -785,7 +785,7 @@ VehStuckProc_Warp_Init = 0x80068e04;
VehTalkMask_ThTick = 0x80068f90;
VehTalkMask_Init = 0x80069178;
VehTalkMask_PlayXA = 0x800691e4;
VehTalkMask_boolNotTalking = 0x8006924c;
VehTalkMask_boolNoXA = 0x8006924c;
VehTalkMask_End = 0x8006925c;
VehTurbo_ProcessBucket = 0x80069284;
VehTurbo_ThDestroy = 0x80069370;