mirror of
https://github.com/ZDoom/Raze.git
synced 2025-01-18 14:41:55 +00:00
- track stuff
This commit is contained in:
parent
b3eceb3b56
commit
1457cf2c0d
9 changed files with 35 additions and 40 deletions
|
@ -486,7 +486,7 @@ int DoActorOperate(DSWActor* actor)
|
|||
|
||||
if (nearsector >= 0 && nearhitdist < 1024)
|
||||
{
|
||||
if (OperateSector(nearsector, false))
|
||||
if (OperateSector(§or[nearsector], false))
|
||||
{
|
||||
u->WaitTics = 2 * 120;
|
||||
|
||||
|
|
|
@ -1646,12 +1646,15 @@ struct SECTOR_OBJECTstruct
|
|||
DSWActor* so_actors[MAX_SO_SPRITE]; // hold the actors of the object
|
||||
DSWActor* match_event_actor; // spritenum of the match event sprite
|
||||
|
||||
sectortype*
|
||||
sectp[MAX_SO_SECTOR],
|
||||
sectortype
|
||||
*sectp[MAX_SO_SECTOR],
|
||||
*scratch, // Just a filler to account for shitty loop tests.
|
||||
*op_main_sector, // main sector operational SO moves in - for speed purposes
|
||||
*mid_sector; // middle sector
|
||||
|
||||
walltype
|
||||
* morph_wall_point; // actual wall point to drag
|
||||
|
||||
|
||||
int vel, // velocity
|
||||
vel_tgt, // target velocity
|
||||
|
@ -1735,7 +1738,6 @@ struct SECTOR_OBJECTstruct
|
|||
scale_y_mult, // y multiplyer for scaling
|
||||
|
||||
// Used for center point movement
|
||||
morph_wall_point, // actual wall point to drag
|
||||
morph_ang, // angle moving from CENTER
|
||||
morph_speed, // speed of movement
|
||||
morph_dist_max, // radius boundry
|
||||
|
@ -2080,7 +2082,7 @@ void LoadGameDescr(short save_num, char *descr); // save.c
|
|||
void SetRotatorActive(DSWActor* actor); // rotator.c
|
||||
|
||||
bool VatorSwitch(short match, short setting); // vator.c
|
||||
void MoveSpritesWithSector(int sectnum,int z_amt,bool type); // vator.c
|
||||
void MoveSpritesWithSector(sectortype* sect,int z_amt,bool type); // vator.c
|
||||
void SetVatorActive(DSWActor*); // vator.c
|
||||
|
||||
void DoSpikeMatch(short match); // spike.c
|
||||
|
|
|
@ -311,7 +311,7 @@ MorphTornado(SECTOR_OBJECTp sop)
|
|||
sop->morph_z += Z(sop->morph_z_speed);
|
||||
|
||||
// move vector
|
||||
if (sop->morph_wall_point < 0)
|
||||
if (sop->morph_wall_point == nullptr)
|
||||
return;
|
||||
|
||||
// place at correct x,y offset from center
|
||||
|
@ -392,7 +392,7 @@ MorphFloor(SECTOR_OBJECTp sop)
|
|||
sop->morph_z -= Z(sop->morph_z_speed);
|
||||
|
||||
// move vector
|
||||
if (sop->morph_wall_point < 0)
|
||||
if (sop->morph_wall_point == nullptr)
|
||||
return;
|
||||
|
||||
// place at correct x,y offset from center
|
||||
|
@ -520,7 +520,7 @@ SpikeFloor(SECTOR_OBJECTp sop)
|
|||
sop->morph_z -= Z(sop->morph_z_speed);
|
||||
|
||||
// move vector
|
||||
if (sop->morph_wall_point < 0)
|
||||
if (sop->morph_wall_point == nullptr)
|
||||
return;
|
||||
|
||||
// place at correct x,y offset from center
|
||||
|
|
|
@ -61,7 +61,7 @@ BEGIN_SW_NS
|
|||
|
||||
void pSpriteControl(PLAYERp pp);
|
||||
int WeaponOperate(PLAYERp pp);
|
||||
SECTOR_OBJECTp PlayerOnObject(short sectnum_match);
|
||||
SECTOR_OBJECTp PlayerOnObject(sectortype* sect_match);
|
||||
void PlayerRemoteReset(PLAYERp pp, sectortype* sect);
|
||||
void KillAllPanelInv(PLAYERp pp);
|
||||
void DoPlayerDeathDrown(PLAYERp pp);
|
||||
|
@ -4963,7 +4963,7 @@ void DoPlayerBeginOperate(PLAYERp pp)
|
|||
int cz, fz;
|
||||
int i;
|
||||
|
||||
sop = PlayerOnObject(pp->cursectnum);
|
||||
sop = PlayerOnObject(pp->cursector());
|
||||
|
||||
// if someone already controlling it
|
||||
if (sop->controller)
|
||||
|
|
|
@ -383,6 +383,7 @@ void SectorSetup(void)
|
|||
SectorObject[ndx].sp_child = nullptr;
|
||||
SectorObject[ndx].mid_sector = nullptr;
|
||||
SectorObject[ndx].op_main_sector = nullptr;
|
||||
SectorObject[ndx].morph_wall_point = nullptr;
|
||||
SectorObject[ndx].xmid = INT32_MAX;
|
||||
}
|
||||
|
||||
|
@ -689,10 +690,9 @@ short DoSpawnActorTrigger(short match)
|
|||
return spawn_count;
|
||||
}
|
||||
|
||||
int OperateSector(short sectnum, short player_is_operating)
|
||||
int OperateSector(sectortype* sect, short player_is_operating)
|
||||
{
|
||||
PLAYERp pp = GlobPlayerP;
|
||||
auto sect = §or[sectnum];
|
||||
|
||||
// Don't let actors operate locked or secret doors
|
||||
if (!player_is_operating)
|
||||
|
@ -2349,7 +2349,7 @@ void PlayerOperateEnv(PLAYERp pp)
|
|||
|
||||
if (neartagsector >= 0 && neartaghitdist < 1024)
|
||||
{
|
||||
if (OperateSector(neartagsector, true))
|
||||
if (OperateSector(§or[neartagsector], true))
|
||||
{
|
||||
// Release the key
|
||||
pp->KeyPressBits &= ~SB_OPEN;
|
||||
|
@ -2382,7 +2382,7 @@ void PlayerOperateEnv(PLAYERp pp)
|
|||
pp->KeyPressBits &= ~SB_OPEN;
|
||||
break;
|
||||
case TAG_DOOR_ROTATE:
|
||||
if (OperateSector(pp->cursectnum, true))
|
||||
if (OperateSector(pp->cursector(), true))
|
||||
pp->KeyPressBits &= ~SB_OPEN;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ void DoDoorsClose(void);
|
|||
short Switch(short SwitchSector);
|
||||
void PlayerOperateEnv(PLAYERp pp);
|
||||
int TeleportToSector(PLAYERp pp, int newsector);
|
||||
int OperateSector(short sectnum,short player_is_operating);
|
||||
int OperateSector(sectortype* sect,short player_is_operating);
|
||||
int OperateSprite(DSWActor*, short player_is_operating);
|
||||
int OperateWall(short wallnum, short player_is_operating);
|
||||
void OperateTripTrigger(PLAYERp pp);
|
||||
|
|
|
@ -2149,7 +2149,7 @@ void SpriteSetup(void)
|
|||
sectp->floorz += amt;
|
||||
u->z_tgt = u->sz;
|
||||
|
||||
MoveSpritesWithSector(sp->sectnum, amt, false); // floor
|
||||
MoveSpritesWithSector(sp->sector(), amt, false); // floor
|
||||
}
|
||||
|
||||
// set orig z
|
||||
|
@ -2170,7 +2170,7 @@ void SpriteSetup(void)
|
|||
sectp->ceilingz += amt;
|
||||
u->z_tgt = u->sz;
|
||||
|
||||
MoveSpritesWithSector(sp->sectnum, amt, true); // ceiling
|
||||
MoveSpritesWithSector(sp->sector(), amt, true); // ceiling
|
||||
}
|
||||
|
||||
// set orig z
|
||||
|
|
|
@ -116,16 +116,15 @@ point to the sprite.
|
|||
|
||||
*/
|
||||
|
||||
short ActorFindTrack(DSWActor* actor, int8_t player_dir, int track_type, int *track_point_num, int *track_dir)
|
||||
short ActorFindTrack(DSWActor* actor, int8_t player_dir, int track_type, int* track_point_num, int* track_dir)
|
||||
{
|
||||
USERp u = actor->u();
|
||||
SPRITEp sp = &actor->s();
|
||||
|
||||
int dist, near_dist = 999999, zdiff;
|
||||
int track_sect=0;
|
||||
|
||||
int i;
|
||||
short end_point[2] = {0,0};
|
||||
short end_point[2] = { 0,0 };
|
||||
|
||||
TRACKp t, near_track = nullptr;
|
||||
TRACK_POINTp tp, near_tp = nullptr;
|
||||
|
@ -251,25 +250,19 @@ short ActorFindTrack(DSWActor* actor, int8_t player_dir, int track_type, int *tr
|
|||
|
||||
}
|
||||
|
||||
auto track_sect = §or[0];
|
||||
if (near_dist < 15000)
|
||||
{
|
||||
// get the sector number of the point
|
||||
updatesector(near_tp->x, near_tp->y, &track_sect);
|
||||
|
||||
// if can see the point, return the track number
|
||||
if (FAFcansee(sp->x, sp->y, sp->z - Z(16), sp->sector(), near_tp->x, near_tp->y, sector[track_sect].floorz - Z(32), §or[track_sect]))
|
||||
if (track_sect && FAFcansee(sp->x, sp->y, sp->z - Z(16), sp->sector(), near_tp->x, near_tp->y, track_sect->floorz - Z(32), track_sect))
|
||||
{
|
||||
//DSPRINTF(ds,"Found track point in sector %d\n",track_sect);
|
||||
MONO_PRINT(ds);
|
||||
return short(near_track - &Track[0]);
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
@ -844,7 +837,7 @@ void SectorObjectSetupBounds(SECTOR_OBJECTp sop)
|
|||
{
|
||||
// for morph point - tornado style
|
||||
if (wal.lotag == TAG_WALL_ALIGN_SLOPE_TO_POINT)
|
||||
sop->morph_wall_point = k;
|
||||
sop->morph_wall_point = &wal;
|
||||
|
||||
if (wal.extra && TEST(wal.extra, WALLFX_LOOP_OUTER))
|
||||
FoundOutsideLoop = true;
|
||||
|
@ -1033,6 +1026,8 @@ void SetupSectorObject(sectortype* sectp, short tag)
|
|||
|
||||
memset(sop->sectp, 0, sizeof(sop->sectp));
|
||||
memset(sop->so_actors, 0, sizeof(sop->so_actors));
|
||||
sop->morph_wall_point = nullptr;
|
||||
sop->op_main_sector = nullptr;
|
||||
sop->scratch = nullptr; // this is a guard field for sectp, because several loops do not test the end properly.
|
||||
sop->match_event_actor = nullptr;
|
||||
sop->crush_z = 0;
|
||||
|
@ -1411,11 +1406,10 @@ void PostSetupSectorObject(void)
|
|||
}
|
||||
|
||||
|
||||
SECTOR_OBJECTp PlayerOnObject(short sectnum_match)
|
||||
SECTOR_OBJECTp PlayerOnObject(sectortype* match)
|
||||
{
|
||||
short i, j;
|
||||
SECTOR_OBJECTp sop;
|
||||
auto match = §or[sectnum_match];
|
||||
|
||||
// place each sector object on the track
|
||||
//for (i = 0; !SO_EMPTY(&SectorObject[i]) && (i < MAX_SECTOR_OBJECTS); i++)
|
||||
|
@ -3256,7 +3250,7 @@ bool ActorTrackDecide(TRACK_POINTp tpoint, DSWActor* actor)
|
|||
|
||||
if (nearsector >= 0 && nearhitdist < 1024)
|
||||
{
|
||||
if (OperateSector(nearsector, false))
|
||||
if (OperateSector(§or[nearsector], false))
|
||||
{
|
||||
if (!tpoint->tag_high)
|
||||
u->WaitTics = 2 * 120;
|
||||
|
|
|
@ -295,15 +295,14 @@ void InterpSectorSprites(short sectnum, bool state)
|
|||
}
|
||||
}
|
||||
|
||||
void MoveSpritesWithSector(int sectnum, int z_amt, bool type)
|
||||
void MoveSpritesWithSector(sectortype* sect, int z_amt, bool type)
|
||||
{
|
||||
SPRITEp sp;
|
||||
bool both = false;
|
||||
auto sect = §or[sectnum];
|
||||
if ( sect->hasU())
|
||||
both = !!TEST(sect->flags, SECTFU_VATOR_BOTH);
|
||||
|
||||
SWSectIterator it(sectnum);
|
||||
SWSectIterator it(sect);
|
||||
while (auto actor = it.Next())
|
||||
{
|
||||
sp = &actor->s();
|
||||
|
@ -417,13 +416,13 @@ int DoVator(DSWActor* actor)
|
|||
{
|
||||
lptr = §p->ceilingz;
|
||||
amt = DoVatorMove(actor, lptr);
|
||||
MoveSpritesWithSector(sp->sectnum, amt, true); // ceiling
|
||||
MoveSpritesWithSector(sp->sector(), amt, true); // ceiling
|
||||
}
|
||||
else
|
||||
{
|
||||
lptr = §p->floorz;
|
||||
amt = DoVatorMove(actor, lptr);
|
||||
MoveSpritesWithSector(sp->sectnum, amt, false); // floor
|
||||
MoveSpritesWithSector(sp->sector(), amt, false); // floor
|
||||
}
|
||||
|
||||
// EQUAL this entry has finished
|
||||
|
@ -579,13 +578,13 @@ int DoVatorAuto(DSWActor* actor)
|
|||
{
|
||||
lptr = §p->ceilingz;
|
||||
amt = DoVatorMove(actor, lptr);
|
||||
MoveSpritesWithSector(sp->sectnum, amt, true); // ceiling
|
||||
MoveSpritesWithSector(sp->sector(), amt, true); // ceiling
|
||||
}
|
||||
else
|
||||
{
|
||||
lptr = §p->floorz;
|
||||
amt = DoVatorMove(actor, lptr);
|
||||
MoveSpritesWithSector(sp->sectnum, amt, false); // floor
|
||||
MoveSpritesWithSector(sp->sector(), amt, false); // floor
|
||||
}
|
||||
|
||||
// EQUAL this entry has finished
|
||||
|
|
Loading…
Reference in a new issue