misc. fodder progress

This commit is contained in:
Matt P 2024-07-04 17:32:32 -05:00
parent 4e53b6bc1c
commit df36ca93e2
7 changed files with 181 additions and 6 deletions

1
.gitignore vendored
View File

@ -1,4 +1,5 @@
.DS_Store
dwarf/
__pycache__
.idea
.ninja_*

View File

@ -195,6 +195,93 @@ void zNPCGoalAlertFodder::GetInArena(float32 dt)
npc->ThrottleApply(dt, &dir, 0);
}
int32 zNPCGoalAttackFodder::Enter(float32 dt, void* updCtxt)
{
zNPCRobot* npc = (zNPCRobot*)this->psyche->clt_owner;
this->haz_cattle = HAZ_Acquire();
if (this->haz_cattle)
{
if (this->haz_cattle->ConfigHelper(NPC_HAZ_CATTLEPROD))
{
this->cbNotify.goal = this;
this->haz_cattle->SetNPCOwner(npc);
this->haz_cattle->NotifyCBSet(&this->cbNotify);
this->haz_cattle->Start(NULL, -1.0f);
}
else
{
this->haz_cattle->Discard();
this->haz_cattle = NULL;
}
}
npc->VelStop();
return this->zNPCGoalPushAnim::Enter(dt, updCtxt);
}
int32 zNPCGoalAttackFodder::Exit(float32 dt, void* updCtxt)
{
if (this->haz_cattle)
{
this->haz_cattle->Discard();
}
this->haz_cattle = NULL;
return this->zNPCGoalPushAnim::Exit(dt, updCtxt);
}
#define f_1370 1.0f
int32 zNPCGoalAttackFodder::SyncCattleProd()
{
xVec3 vec1;
zNPCRobot* npc = (zNPCRobot*)this->psyche->clt_owner;
int32 var1 = this->flg_attack & 0x3;
if (!this->haz_cattle)
{
return var1;
}
if (this->haz_cattle->tmr_remain < f_1370)
{
this->haz_cattle->tym_lifespan = npc->AnimDuration(NULL);
this->haz_cattle->tmr_remain = npc->AnimTimeRemain(NULL);
}
if (!npc->GetVertPos(NPC_MDLVERT_ATTACK, &vec1))
{
return this->flg_attack & 0x3;
}
this->haz_cattle->PosSet(&vec1);
if (this->haz_cattle->flg_hazard & 0x40000000)
{
this->flg_attack |= 0x3;
}
return this->flg_attack & 0x3;
}
int32 zNPCGoalAttackFodder::Process(en_trantype* trantype, float32 dt, void* updCtxt, xScene* scene)
{
if (!this->haz_cattle)
{
*trantype = GOAL_TRAN_POP;
return 1;
}
else
{
this->SyncCattleProd();
}
return this->zNPCGoalPushAnim::Process(trantype, dt, updCtxt, scene);
}
void zNPCGoalAlertFodBzzt::GetInArena(float32 dt)
{
zNPCRobot* npc;

View File

@ -2,6 +2,7 @@
#define ZNPCGOALSTD_H
#include "zNPCGoalCommon.h"
#include "zNPCHazard.h"
enum en_alertbzzt
{
@ -188,11 +189,44 @@ struct zNPCGoalAlertFodBzzt : zNPCGoalCommon
void GetInArena(float32 dt);
};
struct zNPCGoalAlertFodder : zNPCGoalCommon
struct zNPCGoalPushAnim : zNPCGoalCommon
{
int32 flg_attack; // 0x4c
en_alertfod alertfod; // 0x50
float32 tmr_alertfod; // 0x54
int32 flg_pushanim;
float32 lastAnimTime;
// void* __ct(int32 myType);
int32 Enter(float32 dt, void* updCtxt);
};
struct zNPCGoalAttackFodder;
struct CattleNotify : HAZNotify
{
zNPCGoalAttackFodder* goal;
CattleNotify(int32 myType);
int32 Notify(en_haznote note);
};
struct zNPCGoalAttackFodder : zNPCGoalPushAnim
{
xVec3 dir_attack;
int32 flg_attack;
CattleNotify cbNotify;
NPCHazard* haz_cattle; // 0x6C
int32 Process(en_trantype* trantype, float32 dt, void* updCtxt, xScene* xscn);
int32 Exit(float32 dt, void* updCtxt);
int32 Enter(float32 dt, void* updCtxt);
int32 SyncCattleProd();
};
class zNPCGoalAlertFodder : public zNPCGoalCommon
{
public:
signed int flg_attack; // offset 0x4C, size 0x4
enum en_alertfod alertfod; // offset 0x50, size 0x4
float tmr_alertfod; // offset 0x54, size 0x4
void MoveEvade(float32 dt);
void GetInArena(float32 dt);

View File

@ -233,6 +233,7 @@ struct NPCHazard
RwV3d* At();
RwV3d* Right();
RwV3d* Up();
void Discard();
};
void zNPCHazard_Startup();

View File

@ -227,8 +227,8 @@ struct NPCConfig : xListItem<NPCConfig>
xVec3 animFrameRange[9];
int32 cnt_esteem[5];
float32 rad_sound;
NPCSndTrax* snd_trax;
NPCSndTrax* snd_traxShare;
NPCSndTrax* snd_trax; // 0x39C
NPCSndTrax* snd_traxShare; // 0x3A0
int32 test_count;
uint8 talk_filter[4];
uint8 talk_filter_size;
@ -398,6 +398,7 @@ struct zNPCCommon : xNPCBasic
uint32 DBG_InstName(); // return type might be wrong
xAnimTable* AnimGetTable();
float32 AnimTimeRemain(xAnimState* ast);
float32 AnimDuration(xAnimState* ast);
bool IsMountableType(en_ZBASETYPE type);
void MvptReset(zMovePoint* nav_goto);
void ModelScaleSet(float32 x, float32 y, float32 z);

View File

@ -7,6 +7,7 @@
#include "xFactory.h"
#include <string.h>
#include "zGlobals.h"
extern UVAModelInfo g_uvaShield;
extern int32 g_cnt_fodbzzt;
@ -17,6 +18,7 @@ extern int32 g_needuvincr_nightlight;
extern int32 g_needuvincr_slickshield;
extern int32 cnt_alerthokey__11zNPCFodBzzt;
extern NPCSndTrax g_sndTrax_Robot[2];
extern NPCSndTrax g_sndTrax_Fodder;
extern float32 zNPCRobot_f_0_0;
extern float32 zNPCRobot_f_1_0;
@ -399,6 +401,37 @@ void zNPCRobot::InflictPain(int32 numHitPoints, int32 giveCreditToPlayer)
}
}
void test(int32 a)
{
}
void zNPCFodder::ParseINI()
{
zNPCCommon::ParseINI();
cfg_npc->snd_trax = &g_sndTrax_Fodder;
NPCS_SndTablePrepare(&g_sndTrax_Fodder);
}
/*
void zNPCFodder::Stun(float32 stuntime)
{
xVec3 dir_dmg;
if (this->IsWounded())
{
return;
}
xVec3* pos = xEntGetPos(&globals.player.ent);
xVec3* robot_pos = xEntGetPos(this);
xVec3Sub(&dir_dmg, pos, robot_pos);
float32 out = xVec3Normalize(&dir_dmg, robot_pos);
this->Respawn(pos, NULL, NULL);
}
*/
void zNPCFodBzzt_ResetDanceParty()
{
cnt_alerthokey__11zNPCFodBzzt = 0;
@ -451,6 +484,17 @@ xEntDrive* zNPCRobot::PRIV_GetDriverData()
return &raw_drvdata;
}
zNPCLassoInfo* zNPCFodder::PRIV_GetLassoData()
{
return NULL;
}
void zNPCFodder::LassoModelIndex(int32* idxgrab, int32* idxhold)
{
*idxgrab = -1;
*idxhold = -1;
}
int32 xEntIsEnabled(xEnt* ent)
{

View File

@ -150,6 +150,13 @@ struct zNPCRobot : zNPCCommon
struct zNPCFodder : zNPCRobot
{
zNPCFodder(int32 myType);
void Stun(float32 stuntime);
uint32 AnimPick(int32 gid, en_NPC_GOAL_SPOT gspot, xGoal* rawgoal);
void SelfSetup();
void ParseINI();
void Init(xEntAsset* asset);
zNPCLassoInfo* PRIV_GetLassoData();
void LassoModelIndex(int32* idxgrab, int32* idxhold);
};
struct zNPCFodBomb : zNPCRobot