diff --git a/src/SB/Game/zNPCTypeDuplotron.cpp b/src/SB/Game/zNPCTypeDuplotron.cpp index ef6745dfb..8f5cdbd27 100644 --- a/src/SB/Game/zNPCTypeDuplotron.cpp +++ b/src/SB/Game/zNPCTypeDuplotron.cpp @@ -99,6 +99,7 @@ xAnimTable* ZNPC_AnimTable_Duplotron() xAnimDefaultBeforeEnter, NULL, NULL); NPCC_BuildStandardAnimTran(table, g_strz_dupoanim, ourAnims, 1, 0.2); + return table; } void zNPCDuplotron::ParseINI() @@ -128,7 +129,8 @@ void zNPCDuplotron::SelfSetup() S32 zNPCDuplotron::IsAlive() { xPsyche* psy = this->psy_instinct; - psy->GIDOfActive(); + //psy->GIDOfActive(); + return psy->GIDOfActive(); } // non-matching: scheduling? diff --git a/src/SB/Game/zNPCTypeVillager.cpp b/src/SB/Game/zNPCTypeVillager.cpp index 4891b1403..e83131fdc 100644 --- a/src/SB/Game/zNPCTypeVillager.cpp +++ b/src/SB/Game/zNPCTypeVillager.cpp @@ -1,6 +1,19 @@ #include "zNPCTypeVillager.h" #include "zNPCTypes.h" +#include "zNPCGoals.h" + +#define ANIM_Idle01 1 +#define ANIM_Move01 2 +#define ANIM_Hurt01 3 +#define ANIM_Yawn01 4 +#define ANIM_Talk01 5 +#define ANIM_Flee01 6 +#define ANIM_Fear01 7 +#define ANIM_Pray01 8 +#define ANIM_Clap01 9 +#define ANIM_Special01 10 +#define ANIM_Unknown 0 extern char* g_strz_folkanim[26]; extern U32 g_hash_folkanim[26]; @@ -268,6 +281,120 @@ xAnimTable* ZNPC_AnimTable_SuperFriend() return ZNPC_AnimTable_SuperFriend(NULL); } +U8 zNPCVillager::PhysicsFlags() const +{ + S32 flags = 0; + S32 pflags = 0; + if (flg_move & 0x6) + { + flags |= 3; + } + pflags = flags * -5; + if (flg_move & 0x2) + { + pflags = flags |= 4; + } + + return pflags; +} + +void zNPCVillager::Init(xEntAsset* asset) +{ + zNPCCommon::Init(asset); + zNPCCommon::flg_move = 10; + zNPCCommon::flg_vuln = 0; +} + +// void zNPCVillager::Reset() //Not sure what the correct values are for the IFs +// { +// NPCConfig* cfg; +// this->zNPCCommon::Reset(); + +// if (psy_instinct != 0) +// { +// this->psy_instinct->GoalSet(NPC_GOAL_IDLE, 1); +// } +// } + +void zNPCVillager::ParseINI() +{ + zNPCCommon::ParseINI(); + cfg_npc->snd_traxShare = &g_sndTrax_Villager; + NPCS_SndTablePrepare((NPCSndTrax*)&g_sndTrax_Villager); + zNPCVillager::ParseNonRandTalk(); +} + +void zNPCVillager::ParseNonRandTalk() +{ + // NPCConfig* cfg; //0x1d8 + // F32 non_choices[4]; + // S32 found; + // S32 i; + // U8 skip; + // S32 j; + + // cfg = cfg_npc; + // cfg = 0; + // non_choices[0] = 0.0; + // non_choices[1] = 0.0; + // non_choices[2] = 0.0; + // non_choices[3] = 0.0; + + // +} + +void zNPCVillager::Process(xScene* xscn, float dt) +{ + zNPCVillager::ChkCheatSize(); + if (psy_instinct != 0) + { + this->psy_instinct->Timestep(dt, NULL); + } + zNPCCommon::Process(xscn, dt); +} + +void zNPCVillager::SpeakBegin() +{ + psy_instinct->GoalSet(NPC_GOAL_SPEAK, 1); +} + +void zNPCVillager::SpeakEnd() //80% +{ + xPsyche* psy = psy_instinct; + psy->GIDInStack(NPC_GOAL_LIMBO); + + if ((psy == 0) && (psy->GIDOfSafety() != 0)) + { + psy->GoalSet(NPC_GOAL_LIMBO, 1); + } +} + +void zNPCVillager::TossMyConverse() +{ + converse = 0; +} + +void zNPCFish::ParseINI() +{ + zNPCVillager::ParseINI(); + zNPCFish::FishSoundTables(); +} + +// void zNPCFish::FishSoundTables() +// { +// S32 tempR; +// tempR = xNPCBasic::SelfType(); +// switch (tempR) +// { +// case 'NTF0': +// { +// } +// case 'NPC_TYPE_FISH_MALE': +// { +// } +// } +// } + /* void FOLK_InitEffects() { @@ -301,6 +428,14 @@ void zNPCFish::CheckDoChat() { } +void zNPCMerManChair::Init(xEntAsset*) //Seems to load an extra value? +{ + zNPCVillager::Init(asset); + flg_move = 1; + flg_vuln = -1; + flg_vuln = flg_vuln & 0x9effffff; +} + void ztaskbox::callback::on_talk_start() { } diff --git a/src/SB/Game/zNPCTypeVillager.h b/src/SB/Game/zNPCTypeVillager.h index 11f03a669..6549982c8 100644 --- a/src/SB/Game/zNPCTypeVillager.h +++ b/src/SB/Game/zNPCTypeVillager.h @@ -18,7 +18,7 @@ struct HiThere : ztaskbox::callback struct zNPCVillager : zNPCCommon { HiThere hithere; - ztaskbox* converse; + ztaskbox* converse; //0x2a8 S32 current_talk_anim; zNPCVillager(S32 myType); @@ -26,6 +26,18 @@ struct zNPCVillager : zNPCCommon void FindMyConverse(); U8 ColPenByFlags() const; U8 ColChkByFlags() const; + U8 ColPenFlags() const; + U8 PhysicsFlags() const; + void Init(xEntAsset*); + void Reset(); + void ParseINI(); + void ParseNonRandTalk(); + void Process(xScene* xscn, float dt); + void SelfSetup(); + void SpeakBegin(); + void SpeakEnd(); + void TossMyConverse(); + void ChkCheatSize(); F32 GenShadCacheRad(); }; @@ -37,6 +49,8 @@ struct zNPCFish : zNPCVillager xEntDrive raw_drvdata; zNPCFish(S32 myType); + void ParseINI(); + void FishSoundTables(); void CheckDoChat(); }; @@ -77,6 +91,7 @@ struct zNPCMerManChair : zNPCVillager S32 flg_mermanchair; zNPCMerManChair(S32 myType); + void Init(xEntAsset*); U8 PhysicsFlags() const; U8 ColPenFlags() const; U8 ColChkFlags() const; @@ -192,5 +207,17 @@ void ZNPC_Villager_Startup(); void ZNPC_Villager_Shutdown(); xFactoryInst* ZNPC_Create_Villager(S32 who, RyzMemGrow* growCtxt, void*); void ZNPC_Destroy_Villager(xFactoryInst* inst); +NPCSndTrax g_sndTrax_Villager; +S32 zParamGetFloatList(xModelAssetParam* parmdata, U32 pdatsize, const char* str32, S32 found, + F32* non_choices, F32 len_mvptspline); + +extern NPCSndTrax g_sndTrax_VillagerMale; +extern NPCSndTrax g_sndTrax_VillagerFemale; +extern NPCSndTrax g_sndTrax_VillagerElder; +extern NPCSndTrax g_sndTrax_VillagerEldess; +extern NPCSndTrax g_sndTrax_VillagerBoy; +extern NPCSndTrax g_sndTrax_VillagerGirl; +extern NPCSndTrax g_sndTrax_VillagerCoStar; +extern NPCSndTrax g_sndTrax_Squidward; #endif