- give P_ExecuteSpecial a Level parameter.

This commit is contained in:
Christoph Oelckers 2019-01-11 01:03:33 +01:00
parent 1c4e3ae06d
commit 4ec2d31e9f
18 changed files with 111 additions and 98 deletions

View file

@ -2514,7 +2514,7 @@ void Net_DoCommand (int type, uint8_t **stream, int player)
}
if (!CheckCheatmode(player == consoleplayer))
{
P_ExecuteSpecial(snum, NULL, players[player].mo, false, arg[0], arg[1], arg[2], arg[3], arg[4]);
P_ExecuteSpecial(players[player].mo->Level, snum, NULL, players[player].mo, false, arg[0], arg[1], arg[2], arg[3], arg[4]);
}
}
break;

View file

@ -290,7 +290,7 @@ void E_InitStaticHandlers(bool map)
return;
// initialize event handlers from mapinfo
for (const FString& typeName : level.info->EventHandlers)
for (const FString& typeName : currentSession->Levelinfo[0]->info->EventHandlers)
{
PClass* type = E_GetHandlerClass(typeName);
if (E_IsStaticType(type))
@ -712,7 +712,7 @@ static FWorldEvent E_SetupWorldEvent()
{
FWorldEvent e;
e.IsSaveGame = savegamerestore;
e.IsReopen = level.FromSnapshot && !savegamerestore; // each one by itself isnt helpful, but with hub load we have savegamerestore==0 and level.FromSnapshot==1.
e.IsReopen = currentSession->Levelinfo[0]->FromSnapshot && !savegamerestore; // each one by itself isnt helpful, but with hub load we have savegamerestore==0 and level.FromSnapshot==1.
e.DamageAngle = 0.0;
return e;
}

View file

@ -664,6 +664,6 @@ CCMD(fpuke)
}
else
{
T_RunScript(&level, atoi(argv[1]), players[consoleplayer].mo);
T_RunScript(currentSession->Levelinfo[0] , atoi(argv[1]), players[consoleplayer].mo);
}
}

View file

@ -1683,13 +1683,14 @@ void G_DoPlayerPop(int playernum)
}
}
}
auto Level = players[playernum].mo->Level;
// [RH] Make the player disappear
players[playernum].mo->Level->Behaviors.StopMyScripts(players[playernum].mo);
Level->Behaviors.StopMyScripts(players[playernum].mo);
// [ZZ] fire player disconnect hook
E_PlayerDisconnected(playernum);
// [RH] Let the scripts know the player left
players[playernum].mo->Level->Behaviors.StartTypedScripts(&level, SCRIPT_Disconnect, players[playernum].mo, true, playernum, true);
Level->Behaviors.StartTypedScripts(Level, SCRIPT_Disconnect, players[playernum].mo, true, playernum, true);
if (players[playernum].mo != NULL)
{
P_DisconnectEffect(players[playernum].mo);
@ -2027,14 +2028,14 @@ void G_DoAutoSave ()
file = G_BuildSaveName ("auto", nextautosave);
if (!(level.flags2 & LEVEL2_NOAUTOSAVEHINT))
if (!(currentSession->Levelinfo[0]->flags2 & LEVEL2_NOAUTOSAVEHINT))
{
nextautosave = (nextautosave + 1) % count;
}
else
{
// This flag can only be used once per level
level.flags2 &= ~LEVEL2_NOAUTOSAVEHINT;
currentSession->Levelinfo[0]->flags2 &= ~LEVEL2_NOAUTOSAVEHINT;
}
readableTime = myasctime ();
@ -2112,7 +2113,7 @@ void G_DoSaveGame (bool okForQuicksave, FString filename, const char *descriptio
ForAllLevels([&](FLevelLocals *Level) {
// Do not even try, if we're not in a map. (Can happen after a demo finishes playback.)
if (Level->lines.Size() == 0 || level.sectors.Size() == 0)
if (Level->lines.Size() == 0 || Level->sectors.Size() == 0)
{
checkok = false;
}
@ -2391,7 +2392,8 @@ void G_BeginRecording (const char *startmap)
if (startmap == NULL)
{
startmap = level.MapName;
if (!currentSession) return;
startmap = currentSession->Levelinfo[0]->MapName;
}
demo_p = demobuffer;

View file

@ -483,7 +483,7 @@ void G_InitNew (const char *mapname, bool bTitleLevel)
int i;
// did we have any level before?
if (level.info != nullptr)
if (currentSession->Levelinfo[0]->info)
E_WorldUnloadedUnsafe();
if (!savegamerestore)
@ -616,13 +616,14 @@ void G_ChangeLevel(const char *levelname, int position, int flags, int nextSkill
return;
}
auto OldLevel = currentSession->Levelinfo[0]; // Only the primary level is relevant here.
if (levelname == NULL || *levelname == 0)
{
// end the game
levelname = NULL;
if (!level.NextMap.Compare("enDSeQ",6))
if (!OldLevel->NextMap.Compare("enDSeQ",6))
{
nextlevel = level.NextMap; // If there is already an end sequence please leave it alone!
nextlevel = OldLevel->NextMap; // If there is already an end sequence please leave it alone!
}
else
{
@ -658,10 +659,10 @@ void G_ChangeLevel(const char *levelname, int position, int flags, int nextSkill
if (flags & CHANGELEVEL_NOINTERMISSION)
{
level.flags |= LEVEL_NOINTERMISSION;
OldLevel->flags |= LEVEL_NOINTERMISSION;
}
cluster_info_t *thiscluster = FindClusterInfo (level.cluster);
cluster_info_t *thiscluster = FindClusterInfo (OldLevel->cluster);
cluster_info_t *nextcluster = nextinfo? FindClusterInfo (nextinfo->cluster) : NULL;
startpos = position;
@ -688,18 +689,18 @@ void G_ChangeLevel(const char *levelname, int position, int flags, int nextSkill
// [RH] Give scripts a chance to do something
unloading = true;
level.Behaviors.StartTypedScripts (&level, SCRIPT_Unloading, NULL, false, 0, true);
OldLevel->Behaviors.StartTypedScripts (OldLevel, SCRIPT_Unloading, NULL, false, 0, true);
// [ZZ] safe world unload
E_WorldUnloaded();
// [ZZ] unsafe world unload (changemap != map)
E_WorldUnloadedUnsafe();
unloading = false;
STAT_ChangeLevel(nextlevel, &level);
STAT_ChangeLevel(nextlevel, OldLevel);
if (thiscluster && (thiscluster->flags & CLUSTER_HUB))
{
if ((level.flags & LEVEL_NOINTERMISSION) || ((nextcluster == thiscluster) && !(thiscluster->flags & CLUSTER_ALLOWINTERMISSION)))
if ((OldLevel->flags & LEVEL_NOINTERMISSION) || ((nextcluster == thiscluster) && !(thiscluster->flags & CLUSTER_ALLOWINTERMISSION)))
NoWipe = 35;
D_DrawIcon = "TELEICON";
}
@ -715,7 +716,7 @@ void G_ChangeLevel(const char *levelname, int position, int flags, int nextSkill
// If this is co-op, respawn any dead players now so they can
// keep their inventory on the next map.
if ((multiplayer || level.flags2 & LEVEL2_ALLOWRESPAWN || sv_singleplayerrespawn || !!G_SkillProperty(SKILLP_PlayerRespawn))
if ((multiplayer || OldLevel->flags2 & LEVEL2_ALLOWRESPAWN || sv_singleplayerrespawn || !!G_SkillProperty(SKILLP_PlayerRespawn))
&& !deathmatch && player->playerstate == PST_DEAD)
{
// Copied from the end of P_DeathThink [[
@ -759,7 +760,7 @@ const char *G_GetSecretExitMap()
//==========================================================================
//
// The flags here must always be on the primary level.
// The flags here must always be on the primary map.
//
//==========================================================================
@ -814,7 +815,7 @@ void G_DoCompleted ()
P_FreeStrifeConversations ();
wminfo.finished_ep = Level->cluster - 1;
wminfo.LName0 = TexMan.CheckForTexture(level.info->PName, ETextureType::MiscPatch);
wminfo.LName0 = TexMan.CheckForTexture(Level->info->PName, ETextureType::MiscPatch);
wminfo.current = Level->MapName;
if (deathmatch &&
@ -864,7 +865,7 @@ void G_DoCompleted ()
}
// [RH] If we're in a hub and staying within that hub, take a snapshot
// of the level. If we're traveling to a new hub, take stuff from
// of the map. If we're traveling to a new hub, take stuff from
// the player and clear the world vars. If this is just an
// ordinary cluster (not a hub), take stuff from the player, but
// leave the world vars alone.
@ -982,6 +983,7 @@ extern gamestate_t wipegamestate;
void G_DoLoadLevel (int position, bool autosave, bool newGame)
{
static int lastposition = 0;
auto &level = *currentSession->Levelinfo[0];
gamestate_t oldgs = gamestate;
int i;

View file

@ -1916,7 +1916,7 @@ void DPlaneWatcher::Tick ()
if ((LastD < WatchD && newd >= WatchD) ||
(LastD > WatchD && newd <= WatchD))
{
P_ExecuteSpecial(Special, Line, Activator, LineSide, Args[0], Args[1], Args[2], Args[3], Args[4]);
P_ExecuteSpecial(Level, Special, Line, Activator, LineSide, Args[0], Args[1], Args[2], Args[3], Args[4]);
Destroy ();
}
@ -5762,7 +5762,7 @@ int DLevelScript::CallFunction(int argCount, int funcIndex, int32_t *args)
int arg2 = argCount > 2 ? args[2] : 0;
int arg3 = argCount > 3 ? args[3] : 0;
int arg4 = argCount > 4 ? args[4] : 0;
return P_ExecuteSpecial(NamedACSToNormalACS[funcIndex - ACSF_ACS_NamedExecute],
return P_ExecuteSpecial(Level, NamedACSToNormalACS[funcIndex - ACSF_ACS_NamedExecute],
activationline, activator, backSide,
scriptnum, arg1, arg2, arg3, arg4);
}
@ -6981,20 +6981,20 @@ int DLevelScript::RunScript ()
break;
case PCD_LSPEC1:
P_ExecuteSpecial(NEXTBYTE, activationline, activator, backSide,
P_ExecuteSpecial(Level, NEXTBYTE, activationline, activator, backSide,
STACK(1) & specialargmask, 0, 0, 0, 0);
sp -= 1;
break;
case PCD_LSPEC2:
P_ExecuteSpecial(NEXTBYTE, activationline, activator, backSide,
P_ExecuteSpecial(Level, NEXTBYTE, activationline, activator, backSide,
STACK(2) & specialargmask,
STACK(1) & specialargmask, 0, 0, 0);
sp -= 2;
break;
case PCD_LSPEC3:
P_ExecuteSpecial(NEXTBYTE, activationline, activator, backSide,
P_ExecuteSpecial(Level, NEXTBYTE, activationline, activator, backSide,
STACK(3) & specialargmask,
STACK(2) & specialargmask,
STACK(1) & specialargmask, 0, 0);
@ -7002,7 +7002,7 @@ int DLevelScript::RunScript ()
break;
case PCD_LSPEC4:
P_ExecuteSpecial(NEXTBYTE, activationline, activator, backSide,
P_ExecuteSpecial(Level, NEXTBYTE, activationline, activator, backSide,
STACK(4) & specialargmask,
STACK(3) & specialargmask,
STACK(2) & specialargmask,
@ -7011,7 +7011,7 @@ int DLevelScript::RunScript ()
break;
case PCD_LSPEC5:
P_ExecuteSpecial(NEXTBYTE, activationline, activator, backSide,
P_ExecuteSpecial(Level, NEXTBYTE, activationline, activator, backSide,
STACK(5) & specialargmask,
STACK(4) & specialargmask,
STACK(3) & specialargmask,
@ -7021,7 +7021,7 @@ int DLevelScript::RunScript ()
break;
case PCD_LSPEC5RESULT:
STACK(5) = P_ExecuteSpecial(NEXTBYTE, activationline, activator, backSide,
STACK(5) = P_ExecuteSpecial(Level, NEXTBYTE, activationline, activator, backSide,
STACK(5) & specialargmask,
STACK(4) & specialargmask,
STACK(3) & specialargmask,
@ -7031,7 +7031,7 @@ int DLevelScript::RunScript ()
break;
case PCD_LSPEC5EX:
P_ExecuteSpecial(NEXTWORD, activationline, activator, backSide,
P_ExecuteSpecial(Level, NEXTWORD, activationline, activator, backSide,
STACK(5) & specialargmask,
STACK(4) & specialargmask,
STACK(3) & specialargmask,
@ -7041,7 +7041,7 @@ int DLevelScript::RunScript ()
break;
case PCD_LSPEC5EXRESULT:
STACK(5) = P_ExecuteSpecial(NEXTWORD, activationline, activator, backSide,
STACK(5) = P_ExecuteSpecial(Level, NEXTWORD, activationline, activator, backSide,
STACK(5) & specialargmask,
STACK(4) & specialargmask,
STACK(3) & specialargmask,
@ -7052,14 +7052,14 @@ int DLevelScript::RunScript ()
case PCD_LSPEC1DIRECT:
temp = NEXTBYTE;
P_ExecuteSpecial(temp, activationline, activator, backSide,
P_ExecuteSpecial(Level, temp, activationline, activator, backSide,
uallong(pc[0]) & specialargmask ,0, 0, 0, 0);
pc += 1;
break;
case PCD_LSPEC2DIRECT:
temp = NEXTBYTE;
P_ExecuteSpecial(temp, activationline, activator, backSide,
P_ExecuteSpecial(Level, temp, activationline, activator, backSide,
uallong(pc[0]) & specialargmask,
uallong(pc[1]) & specialargmask, 0, 0, 0);
pc += 2;
@ -7067,7 +7067,7 @@ int DLevelScript::RunScript ()
case PCD_LSPEC3DIRECT:
temp = NEXTBYTE;
P_ExecuteSpecial(temp, activationline, activator, backSide,
P_ExecuteSpecial(Level, temp, activationline, activator, backSide,
uallong(pc[0]) & specialargmask,
uallong(pc[1]) & specialargmask,
uallong(pc[2]) & specialargmask, 0, 0);
@ -7076,7 +7076,7 @@ int DLevelScript::RunScript ()
case PCD_LSPEC4DIRECT:
temp = NEXTBYTE;
P_ExecuteSpecial(temp, activationline, activator, backSide,
P_ExecuteSpecial(Level, temp, activationline, activator, backSide,
uallong(pc[0]) & specialargmask,
uallong(pc[1]) & specialargmask,
uallong(pc[2]) & specialargmask,
@ -7086,7 +7086,7 @@ int DLevelScript::RunScript ()
case PCD_LSPEC5DIRECT:
temp = NEXTBYTE;
P_ExecuteSpecial(temp, activationline, activator, backSide,
P_ExecuteSpecial(Level, temp, activationline, activator, backSide,
uallong(pc[0]) & specialargmask,
uallong(pc[1]) & specialargmask,
uallong(pc[2]) & specialargmask,
@ -7097,32 +7097,32 @@ int DLevelScript::RunScript ()
// Parameters for PCD_LSPEC?DIRECTB are by definition bytes so never need and-ing.
case PCD_LSPEC1DIRECTB:
P_ExecuteSpecial(((uint8_t *)pc)[0], activationline, activator, backSide,
P_ExecuteSpecial(Level, ((uint8_t *)pc)[0], activationline, activator, backSide,
((uint8_t *)pc)[1], 0, 0, 0, 0);
pc = (int *)((uint8_t *)pc + 2);
break;
case PCD_LSPEC2DIRECTB:
P_ExecuteSpecial(((uint8_t *)pc)[0], activationline, activator, backSide,
P_ExecuteSpecial(Level, ((uint8_t *)pc)[0], activationline, activator, backSide,
((uint8_t *)pc)[1], ((uint8_t *)pc)[2], 0, 0, 0);
pc = (int *)((uint8_t *)pc + 3);
break;
case PCD_LSPEC3DIRECTB:
P_ExecuteSpecial(((uint8_t *)pc)[0], activationline, activator, backSide,
P_ExecuteSpecial(Level, ((uint8_t *)pc)[0], activationline, activator, backSide,
((uint8_t *)pc)[1], ((uint8_t *)pc)[2], ((uint8_t *)pc)[3], 0, 0);
pc = (int *)((uint8_t *)pc + 4);
break;
case PCD_LSPEC4DIRECTB:
P_ExecuteSpecial(((uint8_t *)pc)[0], activationline, activator, backSide,
P_ExecuteSpecial(Level, ((uint8_t *)pc)[0], activationline, activator, backSide,
((uint8_t *)pc)[1], ((uint8_t *)pc)[2], ((uint8_t *)pc)[3],
((uint8_t *)pc)[4], 0);
pc = (int *)((uint8_t *)pc + 5);
break;
case PCD_LSPEC5DIRECTB:
P_ExecuteSpecial(((uint8_t *)pc)[0], activationline, activator, backSide,
P_ExecuteSpecial(Level, ((uint8_t *)pc)[0], activationline, activator, backSide,
((uint8_t *)pc)[1], ((uint8_t *)pc)[2], ((uint8_t *)pc)[3],
((uint8_t *)pc)[4], ((uint8_t *)pc)[5]);
pc = (int *)((uint8_t *)pc + 6);

View file

@ -3038,7 +3038,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_Teleport)
}
}
DSpotState *state = GetSpotState(&level, false);
DSpotState *state = GetSpotState(self->Level, false);
if (state == NULL)
{
return numret;

View file

@ -989,7 +989,7 @@ static void HandleReply(player_t *player, bool isconsole, int nodenum, int reply
if (reply->ActionSpecial != 0)
{
takestuff |= !!P_ExecuteSpecial(reply->ActionSpecial, NULL, player->mo, false,
takestuff |= !!P_ExecuteSpecial(player->mo->Level, reply->ActionSpecial, NULL, player->mo, false,
reply->Args[0], reply->Args[1], reply->Args[2], reply->Args[3], reply->Args[4]);
}

View file

@ -3926,7 +3926,8 @@ int P_FindLineSpecial (const char *string, int *min_args, int *max_args)
//
//==========================================================================
int P_ExecuteSpecial(int num,
int P_ExecuteSpecial(FLevelLocals *Level,
int num,
struct line_t *line,
class AActor *activator,
bool backSide,
@ -3938,7 +3939,7 @@ int P_ExecuteSpecial(int num,
{
if (num >= 0 && num < (int)countof(LineSpecials))
{
return LineSpecials[num](&level, line, activator, backSide, arg1, arg2, arg3, arg4, arg5);
return LineSpecials[num](Level, line, activator, backSide, arg1, arg2, arg3, arg4, arg5);
}
return 0;
}
@ -3961,6 +3962,6 @@ DEFINE_ACTION_FUNCTION(FLevelLocals, ExecuteSpecial)
PARAM_INT(arg4);
PARAM_INT(arg5);
ACTION_RETURN_INT(P_ExecuteSpecial(special, linedef, activator, lineside, arg1, arg2, arg3, arg4, arg5));
ACTION_RETURN_INT(P_ExecuteSpecial(self, special, linedef, activator, lineside, arg1, arg2, arg3, arg4, arg5));
}

View file

@ -212,7 +212,7 @@ FLineSpecial *P_GetLineSpecialInfo(int num);
int P_GetMaxLineSpecial();
int P_FindLineSpecial (const char *string, int *min_args=NULL, int *max_args=NULL);
bool P_ActivateThingSpecial(AActor * thing, AActor * trigger, bool death=false);
int P_ExecuteSpecial(int num,
int P_ExecuteSpecial(FLevelLocals *Level, int num,
//FLevelLocals *lev, must be added later.
struct line_t *line,
class AActor *activator,

View file

@ -967,7 +967,7 @@ void G_SerializeLevel(FSerializer &arc, FLevelLocals *Level, bool hubload)
arc("zones", Level->Zones);
arc("lineportals", Level->linePortals);
arc("sectorportals", Level->sectorPortals);
if (arc.isReading()) P_FinalizePortals(&level);
if (arc.isReading()) P_FinalizePortals(Level);
// [ZZ] serialize health groups
P_SerializeHealthGroups(Level, arc);

View file

@ -400,7 +400,7 @@ void P_SetupLevel(FLevelLocals *Level, const char *lumpname, int position, bool
players[consoleplayer].viewz = NO_VALUE;
// Make sure all sounds are stopped before Z_FreeTags.
S_Start(&level);
S_Start(currentSession->Levelinfo[0]);
// [RH] clear out the mid-screen message
C_MidPrint(nullptr, nullptr);
@ -658,21 +658,23 @@ CUSTOM_CVAR(Bool, forcewater, false, CVAR_ARCHIVE | CVAR_SERVERINFO)
{
if (gamestate == GS_LEVEL)
{
auto Level = &level;
for (auto &sec : Level->sectors)
ForAllLevels([&](FLevelLocals *Level)
{
sector_t *hsec = sec.GetHeightSec();
if (hsec && !(hsec->MoreFlags & SECMF_UNDERWATER))
for (auto &sec : Level->sectors)
{
if (self)
sector_t *hsec = sec.GetHeightSec();
if (hsec && !(hsec->MoreFlags & SECMF_UNDERWATER))
{
hsec->MoreFlags |= SECMF_FORCEDUNDERWATER;
}
else
{
hsec->MoreFlags &= ~SECMF_FORCEDUNDERWATER;
if (self)
{
hsec->MoreFlags |= SECMF_FORCEDUNDERWATER;
}
else
{
hsec->MoreFlags &= ~SECMF_FORCEDUNDERWATER;
}
}
}
}
});
}
}

View file

@ -183,7 +183,7 @@ bool P_ActivateLine (line_t *line, AActor *mo, int side, int activationType, DVe
lineActivation = line->activation;
repeat = line->flags & ML_REPEAT_SPECIAL;
buttonSuccess = false;
buttonSuccess = P_ExecuteSpecial(line->special,
buttonSuccess = P_ExecuteSpecial(Level, line->special,
line, mo, side == 1, line->args[0],
line->args[1], line->args[2],
line->args[3], line->args[4]);
@ -404,7 +404,7 @@ bool P_PredictLine(line_t *line, AActor *mo, int side, int activationType)
if (line->locknumber > 0) return false;
lineActivation = line->activation;
buttonSuccess = false;
buttonSuccess = P_ExecuteSpecial(line->special,
buttonSuccess = P_ExecuteSpecial(line->GetLevel(), line->special,
line, mo, side == 1, line->args[0],
line->args[1], line->args[2],
line->args[3], line->args[4]);

View file

@ -159,7 +159,6 @@ static void BuildBlockmap(FLevelLocals *Level)
void FLinePortalTraverse::AddLineIntercepts(int bx, int by)
{
auto Level = &level;
if (by < 0 || by >= Level->PortalBlockmap.dy || bx < 0 || bx >= Level->PortalBlockmap.dx) return;
FPortalBlock &block = Level->PortalBlockmap(bx, by);

View file

@ -468,38 +468,41 @@ void InitPortalGroups(FLevelLocals *Level)
CCMD(dumpportals)
{
auto Level = &level;
for(unsigned i=0;i<Level->portalGroups.Size(); i++)
ForAllLevels([](FLevelLocals *Level)
{
auto p = Level->portalGroups[i];
double xdisp = p->mDisplacement.X;
double ydisp = p->mDisplacement.Y;
Printf(PRINT_LOG, "Portal #%d, %s, displacement = (%f,%f)\n", i, p->plane==0? "floor":"ceiling",
xdisp, ydisp);
Printf(PRINT_LOG, "Coverage:\n");
for(auto &sub : Level->subsectors)
Printf("%s - %s:\n", Level->MapName.GetChars(), Level->LevelName.GetChars());
for (unsigned i = 0; i < Level->portalGroups.Size(); i++)
{
auto port = sub.render_sector->GetPortalGroup(p->plane);
if (port == p)
auto p = Level->portalGroups[i];
double xdisp = p->mDisplacement.X;
double ydisp = p->mDisplacement.Y;
Printf(PRINT_LOG, "Portal #%d, %s, displacement = (%f,%f)\n", i, p->plane == 0 ? "floor" : "ceiling",
xdisp, ydisp);
Printf(PRINT_LOG, "Coverage:\n");
for (auto &sub : Level->subsectors)
{
Printf(PRINT_LOG, "\tSubsector %d (%d):\n\t\t", sub.Index(), sub.render_sector->sectornum);
for(unsigned k = 0;k< sub.numlines; k++)
auto port = sub.render_sector->GetPortalGroup(p->plane);
if (port == p)
{
Printf(PRINT_LOG, "(%.3f,%.3f), ", sub.firstline[k].v1->fX() + xdisp, sub.firstline[k].v1->fY() + ydisp);
}
Printf(PRINT_LOG, "\n\t\tCovered by subsectors:\n");
FPortalCoverage *cov = &sub.portalcoverage[p->plane];
for(int l = 0;l< cov->sscount; l++)
{
subsector_t *csub = &Level->subsectors[cov->subsectors[l]];
Printf(PRINT_LOG, "\t\t\t%5d (%4d): ", cov->subsectors[l], csub->render_sector->sectornum);
for(unsigned m = 0;m< csub->numlines; m++)
Printf(PRINT_LOG, "\tSubsector %d (%d):\n\t\t", sub.Index(), sub.render_sector->sectornum);
for (unsigned k = 0; k < sub.numlines; k++)
{
Printf(PRINT_LOG, "(%.3f,%.3f), ", csub->firstline[m].v1->fX(), csub->firstline[m].v1->fY());
Printf(PRINT_LOG, "(%.3f,%.3f), ", sub.firstline[k].v1->fX() + xdisp, sub.firstline[k].v1->fY() + ydisp);
}
Printf(PRINT_LOG, "\n\t\tCovered by subsectors:\n");
FPortalCoverage *cov = &sub.portalcoverage[p->plane];
for (int l = 0; l < cov->sscount; l++)
{
subsector_t *csub = &Level->subsectors[cov->subsectors[l]];
Printf(PRINT_LOG, "\t\t\t%5d (%4d): ", cov->subsectors[l], csub->render_sector->sectornum);
for (unsigned m = 0; m < csub->numlines; m++)
{
Printf(PRINT_LOG, "(%.3f,%.3f), ", csub->firstline[m].v1->fX(), csub->firstline[m].v1->fY());
}
Printf(PRINT_LOG, "\n");
}
Printf(PRINT_LOG, "\n");
}
}
}
}
});
}

View file

@ -813,9 +813,8 @@ public:
//
//=============================================================================
void PrintSections(FSectionContainer &container)
void PrintSections(FLevelLocals *Level, FSectionContainer &container)
{
auto Level = &level;
for (unsigned i = 0; i < container.allSections.Size(); i++)
{
auto &section = container.allSections[i];
@ -879,7 +878,7 @@ CCMD(printsections)
ForAllLevels([](FLevelLocals *Level)
{
Printf("%s - %s\n", Level->MapName.GetChars(), Level->LevelName.GetChars());
PrintSections(Level->sections);
PrintSections(Level, Level->sections);
});
}

View file

@ -134,12 +134,12 @@ void R_UpdateSky (uint64_t mstime)
ForAllLevels([=](FLevelLocals *Level)
{
// Scroll the sky
Level->sky1pos = ms * level.skyspeed1;
Level->sky2pos = ms * level.skyspeed2;
Level->sky1pos = ms * Level->skyspeed1;
Level->sky2pos = ms * Level->skyspeed2;
// The hardware renderer uses a different value range and clamps it to a single rotation
Level->hw_sky1pos = (float)(fmod((double(mstime) * level.skyspeed1), 1024.) * (90. / 256.));
Level->hw_sky2pos = (float)(fmod((double(mstime) * level.skyspeed2), 1024.) * (90. / 256.));
Level->hw_sky1pos = (float)(fmod((double(mstime) * Level->skyspeed1), 1024.) * (90. / 256.));
Level->hw_sky2pos = (float)(fmod((double(mstime) * Level->skyspeed2), 1024.) * (90. / 256.));
});
}

View file

@ -47,6 +47,7 @@
#include "v_text.h"
#include "w_wad.h"
#include "doomstat.h"
#include "g_levellocals.h"
extern FRandom pr_exrandom;
FMemArena FxAlloc(65536);
@ -7783,6 +7784,10 @@ FxExpression *FxFunctionCall::Resolve(FCompileContext& ctx)
return nullptr;
}
FxExpression *self = (ctx.Function && (ctx.Function->Variants[0].Flags & VARF_Method) && isActor(ctx.Class)) ? new FxSelf(ScriptPosition) : (FxExpression*)new FxConstant(ScriptPosition);
if (self->isConstant() && ctx.Version >= MakeVersion(3, 8, 0))
{
ScriptPosition.Message(MSG_WARNING, "Deprecated use of %s. Action specials should only be used from actor methods", MethodName.GetChars());
}
FxExpression *x = new FxActionSpecialCall(self, special, ArgList, ScriptPosition);
delete this;
return x->Resolve(ctx);
@ -8619,7 +8624,7 @@ FxExpression *FxActionSpecialCall::Resolve(FCompileContext& ctx)
int BuiltinCallLineSpecial(int special, AActor *activator, int arg1, int arg2, int arg3, int arg4, int arg5)
{
return P_ExecuteSpecial(special, nullptr, activator, 0, arg1, arg2, arg3, arg4, arg5);
return P_ExecuteSpecial(activator ? activator->Level : currentSession->LevelInfo[0], special, nullptr, activator, 0, arg1, arg2, arg3, arg4, arg5);
}
DEFINE_ACTION_FUNCTION_NATIVE(DObject, BuiltinCallLineSpecial, BuiltinCallLineSpecial)
@ -8633,7 +8638,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(DObject, BuiltinCallLineSpecial, BuiltinCallLineSp
PARAM_INT(arg4);
PARAM_INT(arg5);
ACTION_RETURN_INT(P_ExecuteSpecial(special, nullptr, activator, 0, arg1, arg2, arg3, arg4, arg5));
ACTION_RETURN_INT(BuiltinCallLineSpecial(special, activator, arg1, arg2, arg3, arg4, arg5));
}
ExpEmit FxActionSpecialCall::Emit(VMFunctionBuilder *build)