Beam objects

Place 2 to arbritrarily place the line anywhere. For sprint maps.
This commit is contained in:
Sally Coolatta 2021-02-05 01:58:34 -05:00
parent 90ca38acb0
commit 75dd970adc
6 changed files with 70 additions and 13 deletions

View file

@ -10489,6 +10489,8 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s
"MT_PAPERITEMSPOT",
"MT_BEAMPOINT",
#ifdef SEENAMES
"MT_NAMECHECK",
#endif

View file

@ -28754,6 +28754,33 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
S_NULL // raisestate
},
{ // MT_BEAMPOINT
2424, // doomednum
S_INVISIBLE, // spawnstate
1000, // spawnhealth
S_NULL, // seestate
sfx_None, // seesound
8, // reactiontime
sfx_None, // attacksound
S_NULL, // painstate
0, // painchance
sfx_None, // painsound
S_NULL, // meleestate
S_NULL, // missilestate
S_NULL, // deathstate
S_NULL, // xdeathstate
sfx_None, // deathsound
0, // speed
48*FRACUNIT, // radius
32*FRACUNIT, // height
0, // display offset
100, // mass
1, // damage
sfx_None, // activesound
MF_NOBLOCKMAP|MF_NOSECTOR|MF_NOCLIPTHING|MF_NOGRAVITY|MF_DONTENCOREMAP, // flags
S_NULL // raisestate
},
// ============================================================================================================================//
#ifdef SEENAMES

View file

@ -6383,6 +6383,8 @@ typedef enum mobj_type
MT_PAPERITEMSPOT,
MT_BEAMPOINT,
#ifdef SEENAMES
MT_NAMECHECK,
#endif

View file

@ -43,8 +43,8 @@
static line_t *finishBeamLine = NULL;
mobj_t *beamPoints[2];
UINT8 numBeamPoints = 0;
static mobj_t *beamPoints[2];
static UINT8 numBeamPoints = 0;
/*--------------------------------------------------
void K_ClearFinishBeamLine(void)
@ -53,7 +53,16 @@ UINT8 numBeamPoints = 0;
--------------------------------------------------*/
void K_ClearFinishBeamLine(void)
{
size_t i;
finishBeamLine = NULL;
for (i = 0; i < 2; i++)
{
beamPoints[i] = NULL;
}
numBeamPoints = 0;
}
/*--------------------------------------------------
@ -113,6 +122,8 @@ static void K_CreateFinishLineFromPoints(fixed_t x1, fixed_t y1, fixed_t x2, fix
--------------------------------------------------*/
boolean K_GenerateFinishBeamLine(void)
{
mapthing_t *mt;
INT64 bounds[4];
angle_t angle;
@ -122,9 +133,32 @@ boolean K_GenerateFinishBeamLine(void)
// Ensure everything's freed by this time.
K_FreeFinishBeamLine();
//
// TODO: create from beam point objs before resorting to auto generate
//
// First: attempt to create from beam point objects
for (i = 0, mt = mapthings; i < nummapthings; i++, mt++)
{
if (numBeamPoints >= 2)
{
break;
}
if (mt->type == mobjinfo[MT_BEAMPOINT].doomednum)
{
beamPoints[numBeamPoints] = mt->mobj;
numBeamPoints++;
}
}
if (numBeamPoints == 2)
{
// Found 'em! Really easy to generate a line out of these :)
K_CreateFinishLineFromPoints(
beamPoints[0]->x, beamPoints[0]->y,
beamPoints[1]->x, beamPoints[1]->y
);
return true;
}
bounds[0] = INT64_MAX; // min x
bounds[1] = INT64_MIN; // max x

View file

@ -14,9 +14,6 @@
#include "r_defs.h"
extern mobj_t *beamPoints[2];
extern UINT8 numBeamPoints;
#define FINISHLINEBEAM_SPACING (48*mapobjectscale)
/*--------------------------------------------------

View file

@ -3610,11 +3610,6 @@ static void P_ResetSpawnpoints(void)
for (i = 0; i < 16; i++)
skyboxviewpnts[i] = skyboxcenterpnts[i] = NULL;
// SRB2Kart
numBeamPoints = 0;
for (i = 0; i < 2; i++)
beamPoints[i] = NULL;
}
static void P_LoadRecordGhosts(void)