mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-04-27 04:21:47 +00:00
Super Flicky: do range check from Flicky thinker
- Lets detached Flickys range check.
This commit is contained in:
parent
45eeb94513
commit
dd6c37cac0
1 changed files with 37 additions and 29 deletions
|
|
@ -200,7 +200,6 @@ struct Controller : mobj_t
|
||||||
}
|
}
|
||||||
|
|
||||||
void search();
|
void search();
|
||||||
void range_check();
|
|
||||||
void collect();
|
void collect();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -385,6 +384,41 @@ struct Flicky : mobj_t
|
||||||
K_MatchGenericExtraFlags(fast, this);
|
K_MatchGenericExtraFlags(fast, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void range_check()
|
||||||
|
{
|
||||||
|
if (!chasing())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (FixedHypot(source()->x - chasing()->x, source()->y - chasing()->y) < kScaredRadius * mapobjectscale)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (chasing()->player)
|
||||||
|
{
|
||||||
|
P_SetTarget(&chasing()->player->flickyAttacker, nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
next_target(nullptr);
|
||||||
|
chasing(nullptr);
|
||||||
|
|
||||||
|
if (controller()->mode() != Controller::Mode::kReturning)
|
||||||
|
{
|
||||||
|
for (Flicky* x = controller()->flicky(); x; x = x->next())
|
||||||
|
{
|
||||||
|
if (x != this)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
controller()->chasing(nullptr);
|
||||||
|
controller()->mode(Controller::Mode::kReturning);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void chase()
|
void chase()
|
||||||
{
|
{
|
||||||
if (controller()->ending())
|
if (controller()->ending())
|
||||||
|
|
@ -392,6 +426,8 @@ struct Flicky : mobj_t
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
range_check();
|
||||||
|
|
||||||
vector3_t pos = chasing() ? vector3_t{chasing()->x, chasing()->y, P_GetMobjFeet(chasing())} : orbit_position();
|
vector3_t pos = chasing() ? vector3_t{chasing()->x, chasing()->y, P_GetMobjFeet(chasing())} : orbit_position();
|
||||||
angle_t th = R_PointToAngle2(x, y, pos.x, pos.y);
|
angle_t th = R_PointToAngle2(x, y, pos.x, pos.y);
|
||||||
|
|
||||||
|
|
@ -653,32 +689,6 @@ void Controller::search()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Controller::range_check()
|
|
||||||
{
|
|
||||||
if (!chasing())
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (FixedHypot(source()->x - chasing()->x, source()->y - chasing()->y) < kScaredRadius * mapobjectscale)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (chasing()->player)
|
|
||||||
{
|
|
||||||
P_SetTarget(&chasing()->player->flickyAttacker, nullptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
chasing(nullptr);
|
|
||||||
mode(Mode::kReturning);
|
|
||||||
|
|
||||||
for (Flicky* x = flicky(); x; x = x->next())
|
|
||||||
{
|
|
||||||
x->next_target(nullptr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Controller::collect()
|
void Controller::collect()
|
||||||
{
|
{
|
||||||
if (mode() != Mode::kReturning)
|
if (mode() != Mode::kReturning)
|
||||||
|
|
@ -774,11 +784,9 @@ void Obj_SuperFlickyControllerThink(mobj_t* mobj)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Controller::Mode::kEnRoute:
|
case Controller::Mode::kEnRoute:
|
||||||
x->range_check();
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Controller::Mode::kAttached:
|
case Controller::Mode::kAttached:
|
||||||
x->range_check();
|
|
||||||
x->search();
|
x->search();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue