Skip to content

Commit

Permalink
Merge pull request #628 from FedericoMilesi/MON_SetDefaults
Browse files Browse the repository at this point in the history
[MONLIB]: Implement MON_SetDefaults
  • Loading branch information
FedericoMilesi authored Feb 1, 2024
2 parents f4f56a6 + 879e302 commit 9932a05
Showing 1 changed file with 61 additions and 24 deletions.
85 changes: 61 additions & 24 deletions KAIN2/Game/MONSTER/MONLIB.C
Original file line number Diff line number Diff line change
Expand Up @@ -1175,31 +1175,68 @@ void MON_ProcessIntro(struct _Instance *instance)
}


// autogenerated function stub:
// void /*$ra*/ MON_SetDefaults(struct _Instance *instance /*$a0*/)
void MON_SetDefaults(struct _Instance *instance)
{ // line 2203, offset 0x80081f28
/* begin block 1 */
// Start line: 2205
// Start offset: 0x80081F28
// Variables:
struct _MonsterVars *mv; // $a1
struct _MonsterAttributes *ma; // $a3
struct _MonsterSubAttributes *subAttr; // $a2
/* end block 1 */
// End offset: 0x80082120
// End Line: 2261

/* begin block 2 */
// Start line: 4620
/* end block 2 */
// End Line: 4621
void MON_SetDefaults(struct _Instance* instance) // Matching - 100%
{
struct _MonsterVars* mv;
struct _MonsterAttributes* ma;
struct _MonsterSubAttributes* subAttr;

/* begin block 3 */
// Start line: 4621
/* end block 3 */
// End Line: 4622
UNIMPLEMENTED();
mv = (struct _MonsterVars*)instance->extraData;
ma = (struct _MonsterAttributes*)instance->data;
if (mv->age >= ma->numSubAttributes)
{
mv->age = ma->numSubAttributes - 1;
}
subAttr = ma->subAttributesList[mv->age];
mv->subAttr = subAttr;
instance->currentModel = subAttr->modelNum;
instance->scale.x = instance->scale.y = instance->scale.z = subAttr->scale;
mv->behaviorState = subAttr->defInitialBehavior;
mv->initialBehavior = subAttr->defInitialBehavior;
mv->triggeredBehavior = subAttr->defTriggeredBehavior;
mv->wanderRange = subAttr->defWanderRange;
mv->guardRange = subAttr->defGuardRange;
mv->ambushRange = subAttr->defAmbushRange;
mv->soulJuice = 4096;
mv->alertness = 3;
mv->lastSideMove = 8;
if (subAttr->combatAttributes != NULL)
{
mv->hitPoints = (subAttr->combatAttributes->hitPoints) * 256;
if (subAttr->combatAttributes->missileAttack != -1)
{
mv->mvFlags |= 0x20;
}
}
if ((mv->age == 2) && (ma->whatAmI & 2))
{
mv->mvFlags |= 0x10000000;
}
if (subAttr->defSpectral != 0)
{
instance->flags2 |= 0x08000000;
}
mv->avoidMask = 0x100;
if (subAttr->waterVuln != 0)
{
mv->avoidMask = 0x110;
}
if (subAttr->fireVuln != 0)
{
mv->avoidMask |= 0x20;
}
if (subAttr->sunVuln != 0)
{
mv->avoidMask |= 0x40;
}
if (subAttr->soundVuln != 0)
{
mv->avoidMask |= 0x200;
}
if (subAttr->impaleVuln != 0)
{
mv->avoidMask |= 0x80;
}
}

void MON_GetPlanSlot(struct _MonsterVars* mv)
Expand Down

0 comments on commit 9932a05

Please sign in to comment.