- SW: migrate everything to the main clipmove function

This commit is contained in:
Christoph Oelckers 2021-11-07 19:11:16 +01:00
parent 16f9d4ec36
commit a5f51cfd88
15 changed files with 53 additions and 33 deletions

View file

@ -76,7 +76,7 @@ inline int pushmove(vec3_t *const vect, int *const sectnum, int32_t const walldi
short sect16 = *sectnum;
auto r = pushmove(vect, &sect16, walldist, ceildist, flordist, cliptype, clear);
*sectnum = sect16;
return r;
return r;
}
[[deprecated]]

View file

@ -222,13 +222,12 @@ static void ValidateSprite(spritetype& spr)
}
else if ((unsigned)spr.sectnum >= (unsigned)numsectors)
{
const int32_t osectnum = spr.sectnum;
int sectnum = -1;
updatesector(spr.x, spr.y, &sectnum);
spr.sectnum = sectnum;
spr.sectnum = -1;
updatesector(spr.x, spr.y, &spr.sectnum);
bugged = spr.sectnum < 0;
if (bugged) Printf("Sprite #%d (%d,%d) with invalid sector %d\n", index, spr.x, spr.y, spr.sectnum);
bugged = sectnum < 0;
if (bugged) Printf("Sprite #%d (%d,%d) with invalid sector %d\n", index, spr.x, spr.y, sectnum);
}
if (bugged)
{

View file

@ -322,7 +322,9 @@ void InitLevel(MapRecord *maprec)
int16_t ang;
currentLevel = maprec;
engineLoadBoard(maprec->fileName, SW_SHAREWARE ? 1 : 0, &Player[0].pos, &ang, &Player[0].cursectnum);
short sect16 = -1;
engineLoadBoard(maprec->fileName, SW_SHAREWARE ? 1 : 0, &Player[0].pos, &ang, &sect16);
Player[0].cursectnum = sect16;
SECRET_SetMapName(currentLevel->DisplayName(), currentLevel->name);
STAT_NewLevel(currentLevel->fileName);

View file

@ -736,7 +736,7 @@ typedef void (*PLAYER_ACTION_FUNCp)(PLAYERp);
typedef struct
{
short cursectnum,lastcursectnum,pang,filler;
int cursectnum,lastcursectnum,pang;
int xvect,yvect,oxvect,oyvect,slide_xvect,slide_yvect;
int posx,posy,posz;
SECTOR_OBJECTp sop_control;
@ -789,7 +789,7 @@ struct PLAYERstruct
short circle_camera_ang;
short camera_check_time_delay;
short cursectnum,lastcursectnum;
int cursectnum,lastcursectnum;
fixed_t turn180_target; // 180 degree turn
// variables that do not fit into sprite structure

View file

@ -132,7 +132,7 @@ short MultiClipTurn(PLAYERp pp, short new_ang, int z, int floor_dist)
int x,y;
short ang;
int xvect, yvect;
short cursectnum = pp->cursectnum;
int cursectnum = pp->cursectnum;
for (i = 0; i < sop->clipbox_num; i++)
{

View file

@ -19,10 +19,29 @@ void MapColors(short num,COLOR_MAP cm,short create);
int32_t CONFIG_ReadSetup(void);
bool WarpPlaneSectorInfo(short sectnum, SPRITEp* sp_ceiling, SPRITEp* sp_floor);
SPRITEp WarpPlane(int32_t* x, int32_t* y, int32_t* z, int16_t* sectnum);
SPRITEp WarpToArea(SPRITEp sp_from, int32_t* x, int32_t* y, int32_t* z, int16_t* sectnum);
SPRITEp WarpPlane(int32_t* x, int32_t* y, int32_t* z, int* sectnum);
SPRITEp WarpToArea(SPRITEp sp_from, int32_t* x, int32_t* y, int32_t* z, int* sectnum);
bool WarpSectorInfo(short sectnum, SPRITEp* sp_warp);
SPRITEp Warp(int32_t* x, int32_t* y, int32_t* z, int16_t* sectnum);
SPRITEp Warp(int32_t* x, int32_t* y, int32_t* z, int* sectnum);
[[deprecated]]
SPRITEp Warp(int32_t* x, int32_t* y, int32_t* z, int16_t* sectnum)
{
int sect16 = *sectnum;
auto p= Warp(x, y, z, &sect16);
*sectnum = sect16;
return p;
}
[[deprecated]]
SPRITEp WarpPlane(int32_t* x, int32_t* y, int32_t* z, int16_t* sectnum)
{
int sect16 = *sectnum;
auto p= WarpPlane(x, y, z, &sect16);
*sectnum = sect16;
return p;
}
void ProcessVisOn(void);
void VisViewChange(PLAYERp pp, int* vis);

View file

@ -2142,7 +2142,7 @@ DoPlayerMove(PLAYERp pp)
if (TEST(pp->Flags, PF_CLIP_CHEAT))
{
short sectnum=pp->cursectnum;
int sectnum = pp->cursectnum;
if (interpolate_ride)
{
pp->oposx = pp->posx;
@ -6311,7 +6311,7 @@ void DoPlayerDeathMoveHead(PLAYERp pp)
SPRITEp sp = pp->SpriteP;
USERp u = User[pp->PlayerSprite].Data();
int dax,day;
short sectnum;
int sectnum;
dax = MOVEx(u->slide_vel, u->slide_ang);
day = MOVEy(u->slide_vel, u->slide_ang);

View file

@ -264,7 +264,7 @@ FAFcansee(int32_t xs, int32_t ys, int32_t zs, int16_t sects,
int32_t xe, int32_t ye, int32_t ze, int16_t secte)
{
int loz, hiz;
short newsectnum = sects;
int newsectnum = sects;
int xvect, yvect, zvect;
short ang;
hitdata_t hitinfo;

View file

@ -413,7 +413,6 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, REMOTE_CONTROL& w,
arc("cursectnum", w.cursectnum)
("lastcursectnum", w.lastcursectnum)
("pang", w.pang)
("filler", w.filler)
("xvect", w.xvect)
("yvect", w.yvect)
("slide_xvect", w.slide_xvect)

View file

@ -5021,7 +5021,7 @@ DropAhead(short SpriteNum, short min_height)
SPRITEp sp = &sprite[SpriteNum];
int dax, day;
short newsector;
int newsector;
// dax = sp->x + MOVEx(128, sp->ang);
// day = sp->y + MOVEy(128, sp->ang);
@ -6831,7 +6831,8 @@ int
move_sprite(int spritenum, int xchange, int ychange, int zchange, int ceildist, int flordist, uint32_t cliptype, int numtics)
{
int retval=0, zh;
short dasectnum, tempshort;
int dasectnum;
short tempshort;
SPRITEp spr;
USERp u = User[spritenum].Data();
short lastsectnum;
@ -7078,7 +7079,7 @@ int
move_missile(int spritenum, int xchange, int ychange, int zchange, int ceildist, int flordist, uint32_t cliptype, int numtics)
{
int retval, zh;
short dasectnum, tempshort;
int dasectnum, tempshort;
SPRITEp sp;
USERp u = User[spritenum].Data();
short lastsectnum;
@ -7216,7 +7217,7 @@ move_ground_missile(short spritenum, int xchange, int ychange, int ceildist, int
{
int daz;
int retval=0;
short dasectnum;
int dasectnum;
SPRITEp sp;
USERp u = User[spritenum].Data();
short lastsectnum;

View file

@ -124,7 +124,7 @@ ActorFindTrack(short SpriteNum, int8_t player_dir, int track_type, short *track_
SPRITEp sp = User[SpriteNum]->SpriteP;
int dist, near_dist = 999999, zdiff;
short track_sect=0;
int track_sect=0;
short i;
short end_point[2] = {0,0};
@ -2886,7 +2886,7 @@ void
DoTornadoObject(SECTOR_OBJECTp sop)
{
int xvect,yvect;
short cursect;
int cursect;
// this made them move together more or less - cool!
//static short ang = 1024;
int floor_dist;

View file

@ -81,7 +81,7 @@ WarpPlaneSectorInfo(short sectnum, SPRITEp *sp_ceiling, SPRITEp *sp_floor)
}
SPRITEp
WarpPlane(int32_t* x, int32_t* y, int32_t* z, int16_t* sectnum)
WarpPlane(int32_t* x, int32_t* y, int32_t* z, int* sectnum)
{
SPRITEp sp_floor, sp_ceiling;
@ -111,7 +111,7 @@ WarpPlane(int32_t* x, int32_t* y, int32_t* z, int16_t* sectnum)
}
SPRITEp
WarpToArea(SPRITEp sp_from, int32_t* x, int32_t* y, int32_t* z, int16_t* sectnum)
WarpToArea(SPRITEp sp_from, int32_t* x, int32_t* y, int32_t* z, int* sectnum)
{
int xoff;
int yoff;
@ -245,7 +245,7 @@ WarpSectorInfo(short sectnum, SPRITEp *sp_warp)
}
SPRITEp
Warp(int32_t* x, int32_t* y, int32_t* z, int16_t* sectnum)
Warp(int32_t* x, int32_t* y, int32_t* z, int* sectnum)
{
SPRITEp sp_warp;

View file

@ -12830,7 +12830,7 @@ DoSerpRing(DSWActor* actor)
// if ((dist ok and random ok) OR very few skulls left)
if ((dist < 18000 && (RANDOM_P2(2048<<5)>>5) < 16) || User[sp->owner]->Counter < 4)
{
short sectnum = sp->sectnum;
int sectnum = sp->sectnum;
updatesector(sp->x,sp->y,&sectnum);
// if (valid sector and can see target)
@ -17420,7 +17420,7 @@ HitscanSpriteAdjust(short SpriteNum, short hit_wall)
SPRITEp sp = &sprite[SpriteNum];
int16_t ang;
int xvect,yvect;
short sectnum;
int sectnum;
#if 1
if (hit_wall >= 0)
@ -20265,7 +20265,7 @@ int QueueHole(short hit_sect, short hit_wall, int hit_x, int hit_y, int hit_z)
short SpriteNum;
int nx,ny;
SPRITEp sp;
short sectnum;
int sectnum;
if (TestDontStick(-1,hit_wall))
@ -20544,7 +20544,7 @@ int QueueWallBlood(short hit_sprite, short ang)
short SpriteNum;
int nx,ny;
SPRITEp sp;
short sectnum;
int sectnum;
short rndnum;
int daz;
hitdata_t hitinfo;

View file

@ -843,7 +843,7 @@ SpawnZombie2(short Weapon)
if (FAF_ConnectArea(sp->sectnum))
{
short sectnum = sp->sectnum;
int sectnum = sp->sectnum;
updatesectorz(sp->x, sp->y, sp->z + Z(10), &sectnum);
if (sectnum >= 0 && SectorIsUnderwaterArea(sectnum))
return -1;

View file

@ -211,7 +211,7 @@ struct SWPlayer native
native int16 circle_camera_ang;
native int16 camera_check_time_delay;
native int16 cursectnum,lastcursectnum;
native int cursectnum,lastcursectnum;
native int turn180_target; // 180 degree turn
// variables that do not fit into sprite structure