Bot hints

Thing type 2004, adds a map-defined point for bots to gravitate towards or away from.
Angle: Changes radius, defaults to a 32 radius (or 64x64 area) without.
Ambush: When off, makes bots steer towards. When on, makes bots steer away.
Parameter: Changes how much the bot steers away/towards this point. If 0, defaults to 2.

(also, made bots ignore strong offroad if they could take a shortcut)
This commit is contained in:
Sally Coolatta 2020-04-30 14:15:10 -04:00
parent 174a76f7e8
commit 1fcfdd5bae
5 changed files with 88 additions and 13 deletions

View file

@ -7901,6 +7901,8 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s
"MT_WAYPOINT_RISER", "MT_WAYPOINT_RISER",
"MT_WAYPOINT_ANCHOR", "MT_WAYPOINT_ANCHOR",
"MT_BOTHINT",
"MT_RANDOMAUDIENCE", "MT_RANDOMAUDIENCE",
"MT_FLAYM", "MT_FLAYM",

View file

@ -16582,6 +16582,33 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
S_NULL // raisestate S_NULL // raisestate
}, },
{ // MT_BOTHINT
2004, // doomednum
S_INVISIBLE, // spawnstate
1000, // spawnhealth
S_NULL, // seestate
sfx_None, // seesound
0, // reactiontime
sfx_None, // attacksound
S_NULL, // painstate
100, // painchance
sfx_None, // painsound
S_NULL, // meleestate
S_NULL, // missilestate
S_NULL, // deathstate
S_NULL, // xdeathstate
sfx_None, // deathsound
0, // speed
1*FRACUNIT, // radius
2*FRACUNIT, // height
0, // display offset
100, // mass
0, // damage
sfx_None, // activesound
MF_NOCLIP|MF_NOGRAVITY|MF_SCENERY, // flags
S_NULL // raisestate
},
{ // MT_RANDOMAUDIENCE { // MT_RANDOMAUDIENCE
1488, // doomednum 1488, // doomednum
S_RANDOMAUDIENCE, // spawnstate S_RANDOMAUDIENCE, // spawnstate

View file

@ -4832,6 +4832,8 @@ typedef enum mobj_type
MT_WAYPOINT_RISER, MT_WAYPOINT_RISER,
MT_WAYPOINT_ANCHOR, MT_WAYPOINT_ANCHOR,
MT_BOTHINT,
MT_RANDOMAUDIENCE, MT_RANDOMAUDIENCE,
MT_FLAYM, MT_FLAYM,

View file

@ -209,24 +209,19 @@ static fixed_t K_DistanceOfLineFromPoint(fixed_t v1x, fixed_t v1y, fixed_t v2x,
return P_AproxDistance(cx - px, cy - py); return P_AproxDistance(cx - px, cy - py);
} }
mobj_t *botmo = NULL; static boolean K_BotHatesThisSector(player_t *player, sector_t *sec)
fixed_t distancetocheck = 0;
fixed_t closestlinedist = INT32_MAX;
INT16 badsteerglobal = 0;
static boolean K_BotHatesThisSector(sector_t *sec)
{ {
switch (GETSECSPECIAL(sec->special, 1)) switch (GETSECSPECIAL(sec->special, 1))
{ {
case 1: // Damage case 1: // Damage
//case 2: case 3: // Offroad (let's let them lawnmower)
case 4: // Offroad (Strong)
case 5: // Spikes case 5: // Spikes
case 6: case 7: // Death Pit case 6: case 7: // Death Pit
case 8: // Instant Kill case 8: // Instant Kill
return true; return true;
//case 2: case 3: // Offroad (let's let them lawnmower)
case 4: // Offroad (Strong)
if (!K_BotCanTakeCut(player))
return true;
default: default:
break; break;
} }
@ -234,6 +229,13 @@ static boolean K_BotHatesThisSector(sector_t *sec)
return false; return false;
} }
mobj_t *botmo = NULL;
fixed_t distancetocheck = 0;
fixed_t closestlinedist = INT32_MAX;
INT16 badsteerglobal = 0;
static inline boolean K_FindBlockingWalls(line_t *line) static inline boolean K_FindBlockingWalls(line_t *line)
{ {
// Condensed version of PIT_CheckLine // Condensed version of PIT_CheckLine
@ -300,18 +302,18 @@ static inline boolean K_FindBlockingWalls(line_t *line)
goto blocked; goto blocked;
} }
if (!K_BotHatesThisSector(botmo->subsector->sector)) if (!K_BotHatesThisSector(botmo->player, botmo->subsector->sector))
{ {
// Treat damage sectors like walls // Treat damage sectors like walls
if (lineside) if (lineside)
{ {
if (K_BotHatesThisSector(line->frontsector)) if (K_BotHatesThisSector(botmo->player, line->frontsector))
goto blocked; goto blocked;
} }
else else
{ {
if (K_BotHatesThisSector(line->backsector)) if (K_BotHatesThisSector(botmo->player, line->backsector))
goto blocked; goto blocked;
} }
} }
@ -700,6 +702,15 @@ static boolean K_BotSteerObjects(mobj_t *thing)
} }
} }
break; break;
case MT_BOTHINT:
if (thing->extravalue1 == 0)
{
K_SteerFromObject(botmo, thing, fulldist, xdist, false, thing->extravalue2 * (KART_FULLTURN + dodge));
}
{
K_SteerFromObject(botmo, thing, fulldist, xdist, true, thing->extravalue2 * (KART_FULLTURN + attack));
}
break;
default: default:
if (thing->flags & (MF_SOLID|MF_ENEMY|MF_BOSS|MF_PAIN|MF_MISSILE|MF_FIRE)) if (thing->flags & (MF_SOLID|MF_ENEMY|MF_BOSS|MF_PAIN|MF_MISSILE|MF_FIRE))
{ {

View file

@ -12691,6 +12691,39 @@ ML_NOCLIMB : Direction not controllable
P_SetTarget(&waypointcap, mobj); P_SetTarget(&waypointcap, mobj);
break; break;
} }
case MT_BOTHINT:
{
// Change size
if (mthing->angle > 0)
{
mobj->radius = mthing->angle * FRACUNIT;
}
else
{
mobj->radius = 32 * mapobjectscale;
}
// Steer away instead of towards
if (mthing->options & MTF_AMBUSH)
{
mobj->extravalue1 = 0;
}
else
{
mobj->extravalue1 = 1;
}
// Steering amount
if (mthing->extrainfo == 0)
{
mobj->extravalue2 = 2;
}
else
{
mobj->extravalue2 = mthing->extrainfo;
}
break;
}
// SRB2Kart // SRB2Kart
case MT_BALLOON: case MT_BALLOON:
mobj->color = (1 + (mthing->angle % (MAXSKINCOLORS-1))); mobj->color = (1 + (mthing->angle % (MAXSKINCOLORS-1)));