Skip to content

Commit

Permalink
Opposing AI attack each other now
Browse files Browse the repository at this point in the history
  • Loading branch information
shinyquagsire23 committed Jan 2, 2023
1 parent 96be33e commit 512d653
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 21 deletions.
7 changes: 3 additions & 4 deletions src/AI/sithAI.c
Original file line number Diff line number Diff line change
Expand Up @@ -1364,15 +1364,14 @@ int sithAI_FireWeapon(sithActor *actor, float a2, float a3, float a4, float a5,
return 0;

// MoTS added
if (Main_bMotsCompat && a4 > 0.0) {
if (Main_bMotsCompat && a4 < 0.0) {
return 0;
}

v19 = rdVector_Dot3(&v9->lookOrientation.rvec, &v1);
if ( v19 < 0.0 )
v19 = -v19;
v19 = fabs(rdVector_Dot3(&v9->lookOrientation.rvec, &v1));
if ( v19 > 1.0 - a4 )
return 0;

if ( (v9->actorParams.typeflags & SITH_AF_DELAYFIRE) != 0 )
{
actor->field_268 = a7 | 8;
Expand Down
36 changes: 19 additions & 17 deletions src/AI/sithAICmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -543,26 +543,27 @@ int sithAICmd_PrimaryFire(sithActor *actor, sithAIClassEntry *aiclass, sithActor
v7 = actor->thing;
if ( flags )
{
if ( flags == SITHAI_MODE_UNK100 )
if ( flags != SITHAI_MODE_UNK100 )
{
if ( (actor->flags & SITHAI_MODE_ACTIVE) != 0 )
{
sithPuppet_SetArmedMode(v7, 1);
v9 = sithTime_curMs + aiclass->argsAsInt[5];
instinct->param0 = aiclass->argsAsFloat[8];
instinct->nextUpdate = v9;
}
else
{
sithPuppet_SetArmedMode(v7, 0);
}

// Added: co-op
if (sithNet_isMulti && sithNet_MultiModeFlags & MULTIMODEFLAG_COOP) {
sithThing_SetSyncFlags(actor->thing, THING_SYNC_PUPPET);
}
return 0;
}

if ( (actor->flags & SITHAI_MODE_ACTIVE) != 0 )
{
sithPuppet_SetArmedMode(v7, 1);
v9 = sithTime_curMs + aiclass->argsAsInt[5];
instinct->param0 = aiclass->argsAsFloat[8];
instinct->nextUpdate = v9;
}
else
{
sithPuppet_SetArmedMode(v7, 0);
}

// Added: co-op
if (sithNet_isMulti && sithNet_MultiModeFlags & MULTIMODEFLAG_COOP) {
sithThing_SetSyncFlags(actor->thing, THING_SYNC_PUPPET);
}
return 0;
}
if ( !actor->pDistractor )
Expand All @@ -573,6 +574,7 @@ int sithAICmd_PrimaryFire(sithActor *actor, sithAIClassEntry *aiclass, sithActor
v5 = 1;
if ( aiclass->argsAsFloat[7] != 0.0 && aiclass->argsAsFloat[7] >= _frand() )
v6 = 1;

if ( sithAI_FireWeapon(actor, aiclass->argsAsFloat[4], aiclass->argsAsFloat[2], aiclass->argsAsFloat[1], aiclass->argsAsFloat[3], v6, v5) )
{
actor->flags |= SITHAI_MODE_TARGET_VISIBLE;
Expand Down
30 changes: 30 additions & 0 deletions src/Main/jkAI.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,21 @@ void jkAI_Startup()
}

// MoTS altered
/*
p0 - Strike% 0 never 1 continuous
p1 - Att1 Range
p2 - Att1 Damage
p3 - Att1 Duration
p4 - Att2 Range
p5 - Att2 Damage
p6 - Att2 Duration
p7 - Att3 Range
p8 - Att3 Damage
p9 - Att3 Duration
p10 - Att4 Range
p11 - Att4 Damage
p12 - Att4 Duration
*/
int jkAI_SaberFighting(sithActor *actor, sithAIClassEntry *aiclass, sithActorInstinct *instinct, int flags, int extra)
{
unsigned int v5; // edi
Expand Down Expand Up @@ -247,6 +262,21 @@ int jkAI_SpecialAttack(sithActor *actor, sithAIClassEntry *aiclass, sithActorIns
return 0;
}

/*
p0 - Interval for Force power check
p1 - Min Dist for FP1
p2 - Max Dist for FP1
p3 - Min Dist for FP2
p4 - Max Dist for FP2
p5 - Min Dist for FP3
p6 - Max Dist for FP3
p7 - % Interval for FP1
p8 - % Interval for FP2
p9 - % Interval for FP3
p10 - recharge time for FP1 (msec)
p11 - recharge time for FP2 (msec)
p12 - recharge time for FP3 (msec)
*/
int jkAI_ForcePowers(sithActor *actor, sithAIClassEntry *aiclass, sithActorInstinct *instinct, int flags, int extra)
{
int v6; // ebx
Expand Down

0 comments on commit 512d653

Please sign in to comment.