diff --git a/source/build/include/clip.h b/source/build/include/clip.h index d8f4f2353..521e505de 100644 --- a/source/build/include/clip.h +++ b/source/build/include/clip.h @@ -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, §16, walldist, ceildist, flordist, cliptype, clear); *sectnum = sect16; - return r; + return r; } [[deprecated]] diff --git a/source/core/maploader.cpp b/source/core/maploader.cpp index 4ab51bd81..4cd284321 100644 --- a/source/core/maploader.cpp +++ b/source/core/maploader.cpp @@ -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, §num); + 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) { diff --git a/source/games/sw/src/game.cpp b/source/games/sw/src/game.cpp index e2de44aca..59b5c05af 100644 --- a/source/games/sw/src/game.cpp +++ b/source/games/sw/src/game.cpp @@ -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, §16); + Player[0].cursectnum = sect16; SECRET_SetMapName(currentLevel->DisplayName(), currentLevel->name); STAT_NewLevel(currentLevel->fileName); diff --git a/source/games/sw/src/game.h b/source/games/sw/src/game.h index c3caf919c..c5916c627 100644 --- a/source/games/sw/src/game.h +++ b/source/games/sw/src/game.h @@ -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 diff --git a/source/games/sw/src/mclip.cpp b/source/games/sw/src/mclip.cpp index 97537ae1c..04c64d618 100644 --- a/source/games/sw/src/mclip.cpp +++ b/source/games/sw/src/mclip.cpp @@ -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++) { diff --git a/source/games/sw/src/misc.h b/source/games/sw/src/misc.h index 1adc37e89..b7c4cb8a9 100644 --- a/source/games/sw/src/misc.h +++ b/source/games/sw/src/misc.h @@ -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, §16); + *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, §16); + *sectnum = sect16; + return p; +} + void ProcessVisOn(void); void VisViewChange(PLAYERp pp, int* vis); diff --git a/source/games/sw/src/player.cpp b/source/games/sw/src/player.cpp index d2a7e11c7..62a781f4c 100644 --- a/source/games/sw/src/player.cpp +++ b/source/games/sw/src/player.cpp @@ -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); diff --git a/source/games/sw/src/rooms.cpp b/source/games/sw/src/rooms.cpp index ba5ccaf92..42ac1213a 100644 --- a/source/games/sw/src/rooms.cpp +++ b/source/games/sw/src/rooms.cpp @@ -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; diff --git a/source/games/sw/src/save.cpp b/source/games/sw/src/save.cpp index a24351886..09bc6c6d4 100644 --- a/source/games/sw/src/save.cpp +++ b/source/games/sw/src/save.cpp @@ -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) diff --git a/source/games/sw/src/sprite.cpp b/source/games/sw/src/sprite.cpp index 215edc7ca..353c54760 100644 --- a/source/games/sw/src/sprite.cpp +++ b/source/games/sw/src/sprite.cpp @@ -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; diff --git a/source/games/sw/src/track.cpp b/source/games/sw/src/track.cpp index 5054e824b..88ebb7659 100644 --- a/source/games/sw/src/track.cpp +++ b/source/games/sw/src/track.cpp @@ -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; diff --git a/source/games/sw/src/warp.cpp b/source/games/sw/src/warp.cpp index 2b4bd0bd9..ad66656d7 100644 --- a/source/games/sw/src/warp.cpp +++ b/source/games/sw/src/warp.cpp @@ -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; diff --git a/source/games/sw/src/weapon.cpp b/source/games/sw/src/weapon.cpp index 6fea43f14..ce6359a21 100644 --- a/source/games/sw/src/weapon.cpp +++ b/source/games/sw/src/weapon.cpp @@ -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,§num); // 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; diff --git a/source/games/sw/src/zombie.cpp b/source/games/sw/src/zombie.cpp index 840589313..914c041dc 100644 --- a/source/games/sw/src/zombie.cpp +++ b/source/games/sw/src/zombie.cpp @@ -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), §num); if (sectnum >= 0 && SectorIsUnderwaterArea(sectnum)) return -1; diff --git a/wadsrc/static/zscript/games/sw/swgame.zs b/wadsrc/static/zscript/games/sw/swgame.zs index 970819541..a4f7f15d9 100644 --- a/wadsrc/static/zscript/games/sw/swgame.zs +++ b/wadsrc/static/zscript/games/sw/swgame.zs @@ -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