Permalink
Browse files

- some progress.

  • Loading branch information...
coelckers committed Jan 10, 2019
1 parent f25397b commit 3b59afae31824cc313ae0068e7773bfd3060818a
@@ -3166,7 +3166,7 @@ void AM_drawMarks ()
//
//=============================================================================

void AM_drawAuthorMarkers ()
void AM_drawAuthorMarkers (FLevelLocals *Level)
{
// [RH] Draw any actors derived from AMapMarker on the automap.
// If args[0] is 0, then the actor's sprite is drawn at its own location.
@@ -3211,7 +3211,7 @@ void AM_drawAuthorMarkers ()
tex = TexMan.GetTexture(picnum);
}
}
FActorIterator it (&level, mark->args[0]);
FActorIterator it (Level, mark->args[0]);
AActor *marked = mark->args[0] == 0 ? mark : it.Next();

while (marked != NULL)
@@ -3293,7 +3293,7 @@ void AM_Drawer (FLevelLocals *Level, int bottom)
if ((am_cheat >= 2 && am_cheat != 4) || allthings)
AM_drawThings(Level);

AM_drawAuthorMarkers();
AM_drawAuthorMarkers(Level);

if (!viewactive)
AM_drawCrosshair(AMColors[AMColors.XHairColor]);
@@ -361,7 +361,7 @@ CCMD (changemap)
if (argv.argc() > 1)
{
const char *mapname = argv[1];
if (!strcmp(mapname, "*")) mapname = level.MapName.GetChars();
if (!strcmp(mapname, "*") && currentSession) mapname = currentSession->Levelinfo[0]->MapName.GetChars();

try
{
@@ -758,16 +758,16 @@ void D_Display ()
viewsec = screen->RenderView(&players[consoleplayer]);
screen->Begin2D();
screen->DrawBlend(viewsec);
if (automapactive)
if (automapactive && currentSession)
{
AM_Drawer (&level, hud_althud? viewheight : StatusBar->GetTopOfStatusbar());
AM_Drawer (currentSession->Levelinfo[0], hud_althud? viewheight : StatusBar->GetTopOfStatusbar());
}

// for timing the statusbar code.
//cycle_t stb;
//stb.Reset();
//stb.Clock();
StatusBar->SetLevel(&level);
StatusBar->SetLevel(currentSession->Levelinfo[0]);
if (!automapactive || viewactive)
{
StatusBar->RefreshViewBorder ();
@@ -135,7 +135,7 @@ void FScriptLoader::ParseInfoCmd(char *line, FString &scriptsrc)
sc.MustGetString();
if (!FS_ChangeMusic(sc.String))
{
S_ChangeMusic(Level->Music, Level->musicorder);
Level->SetMusic();
}
}
else if (sc.Compare("skyname"))
@@ -759,7 +759,7 @@ void G_AddViewPitch (int look, bool mouse)
return;
}
look = LookAdjust(look);
if (!players[consoleplayer].mo->Level->IsFreelookAllowed())
if (currentSession && !currentSession->Levelinfo[0]->IsFreelookAllowed())
{
LocalViewPitch = 0;
}
@@ -1504,7 +1504,7 @@ void G_DeathMatchSpawnPlayer (FLevelLocals *Level, int playernum)
//
FPlayerStart *G_PickPlayerStart(FLevelLocals *Level, int playernum, int flags)
{
if (level.AllPlayerStarts.Size() == 0) // No starts to pick
if (Level->AllPlayerStarts.Size() == 0) // No starts to pick
{
return NULL;
}
@@ -1522,7 +1522,7 @@ FPlayerStart *G_PickPlayerStart(FLevelLocals *Level, int playernum, int flags)
{
if (G_CheckSpot(Level, playernum, &Level->AllPlayerStarts[i]))
{
good_starts.Push(&level.AllPlayerStarts[i]);
good_starts.Push(&Level->AllPlayerStarts[i]);
}
}
if (good_starts.Size() > 0)
@@ -1533,15 +1533,15 @@ FPlayerStart *G_PickPlayerStart(FLevelLocals *Level, int playernum, int flags)
// Pick a spot at random, whether it's open or not.
return &Level->AllPlayerStarts[pr_pspawn(Level->AllPlayerStarts.Size())];
}
return &level.playerstarts[playernum];
return &Level->playerstarts[playernum];
}

DEFINE_ACTION_FUNCTION(DObject, G_PickPlayerStart)
{
PARAM_PROLOGUE;
PARAM_INT(playernum);
PARAM_INT(flags);
auto ps = G_PickPlayerStart(&level, playernum, flags);
auto ps = currentSession ? G_PickPlayerStart(currentSession->Levelinfo[0], playernum, flags) : nullptr;
if (numret > 1)
{
ret[1].SetInt(ps? ps->angle : 0);
@@ -1561,7 +1561,7 @@ static void G_QueueBody (AActor *body)
{
auto Level = body->Level;
// flush an old corpse if needed
int modslot = level.bodyqueslot % FLevelLocals::BODYQUESIZE;
int modslot = Level->bodyqueslot % FLevelLocals::BODYQUESIZE;
Level->bodyqueslot = modslot + 1;

if (Level->bodyqueslot >= FLevelLocals::BODYQUESIZE && Level->bodyque[modslot] != NULL)
@@ -76,15 +76,15 @@ struct FHubInfo

static TArray<FHubInfo> hubdata;

void G_LeavingHub(int mode, cluster_info_t * cluster, wbstartstruct_t * wbs)
void G_LeavingHub(int mode, cluster_info_t * cluster, wbstartstruct_t * wbs, FLevelLocals *Level)
{
unsigned int i, j;

if (cluster->flags & CLUSTER_HUB)
{
for (i = 0; i < hubdata.Size(); i++)
{
if (hubdata[i].levelnum == level.levelnum)
if (hubdata[i].levelnum == Level->levelnum)
{
hubdata[i] = *wbs;
break;
@@ -95,13 +95,13 @@ void G_LeavingHub(int mode, cluster_info_t * cluster, wbstartstruct_t * wbs)
hubdata[hubdata.Reserve(1)] = *wbs;
}

hubdata[i].levelnum = level.levelnum;
hubdata[i].levelnum = Level->levelnum;
if (!multiplayer && !deathmatch)
{
// The player counters don't work in hubs
hubdata[i].plyr[0].skills = level.killed_monsters;
hubdata[i].plyr[0].sitems = level.found_items;
hubdata[i].plyr[0].ssecret = level.found_secrets;
hubdata[i].plyr[0].skills = Level->killed_monsters;
hubdata[i].plyr[0].sitems = Level->found_items;
hubdata[i].plyr[0].ssecret = Level->found_secrets;
}


@@ -129,11 +129,11 @@ void G_LeavingHub(int mode, cluster_info_t * cluster, wbstartstruct_t * wbs)
{
if (cluster->flags & CLUSTER_LOOKUPNAME)
{
level.LevelName = GStrings(cluster->ClusterName);
Level->LevelName = GStrings(cluster->ClusterName);
}
else
{
level.LevelName = cluster->ClusterName;
Level->LevelName = cluster->ClusterName;
}
}
}
@@ -4,9 +4,10 @@
struct cluster_info_t;
struct wbstartstruct_t;
class FSerializer;
struct FLevelLocals;

void G_SerializeHub (FSerializer &file);
void G_LeavingHub(int mode, cluster_info_t * cluster, struct wbstartstruct_t * wbs);
void G_LeavingHub(int mode, cluster_info_t * cluster, struct wbstartstruct_t * wbs, FLevelLocals *Level);

#endif

@@ -887,7 +887,7 @@ void G_DoCompleted ()
}

// Intermission stats for entire hubs
G_LeavingHub(mode, thiscluster, &wminfo);
G_LeavingHub(mode, thiscluster, &wminfo, &level);

for (i = 0; i < MAXPLAYERS; i++)
{
@@ -1525,8 +1525,6 @@ void FLevelLocals::InitLevelLocals ()
skytexture1 = TexMan.GetTextureID(info->SkyPic1, ETextureType::Wall, FTextureManager::TEXMAN_Overridable | FTextureManager::TEXMAN_ReturnFirst);
skytexture2 = TexMan.GetTextureID(info->SkyPic2, ETextureType::Wall, FTextureManager::TEXMAN_Overridable | FTextureManager::TEXMAN_ReturnFirst);
fadeto = info->fadeto;
cdtrack = info->cdtrack;
cdid = info->cdid;
FromSnapshot = false;
if (fadeto == 0)
{
@@ -2190,6 +2188,11 @@ DEFINE_ACTION_FUNCTION(FLevelLocals, SetInterMusic)
return 0;
}

void FLevelLocals::SetMusic()
{
if (info->cdtrack == 0 || !S_ChangeCDMusic(info->cdtrack, info->cdid))
S_ChangeMusic(Music, musicorder);
}
//==========================================================================
//
//
@@ -127,6 +127,7 @@ struct FLevelLocals : public FLevelData
void Mark();
void AddScroller(int secnum);
void SetInterMusic(const char *nextmap);
void SetMusic();
void SetMusicVolume(float v);
void ClearLevelData();
void ClearPortals();
@@ -202,8 +203,7 @@ struct FLevelLocals : public FLevelData

FString Music;
int musicorder;
int cdtrack;
unsigned int cdid;

FTextureID skytexture1;
FTextureID skytexture2;

@@ -411,7 +411,10 @@ inline bool line_t::hitSkyWall(AActor* mo) const
template<class T>
inline void ForAllLevels(T func)
{
func(&level);
if (currentSession)
{
for (auto Level : currentSession->Levelinfo) func(Level);
}
}

#endif
@@ -787,8 +787,7 @@ void DIntermissionController::Ticker ()
switch (mGameState)
{
case FSTATE_InLevel:
if (level.cdtrack == 0 || !S_ChangeCDMusic (level.cdtrack, level.cdid))
S_ChangeMusic (level.Music, level.musicorder);
currentSession->Levelinfo[0]->SetMusic();
gamestate = GS_LEVEL;
wipegamestate = GS_LEVEL;
P_ResumeConversation ();
@@ -54,17 +54,17 @@ const int AAPreference = 16;
#define D(x) do{}while(0)
#endif

FNodeBuilder::FNodeBuilder(FLevel &level)
: Level(level), GLNodes(false), SegsStuffed(0)
FNodeBuilder::FNodeBuilder(FLevel &_level)
: Level(_level), GLNodes(false), SegsStuffed(0)
{
VertexMap = NULL;
OldVertexTable = NULL;
}

FNodeBuilder::FNodeBuilder (FLevel &level,
FNodeBuilder::FNodeBuilder (FLevel &_level,
TArray<FPolyStart> &polyspots, TArray<FPolyStart> &anchors,
bool makeGLNodes)
: Level(level), GLNodes(makeGLNodes), SegsStuffed(0)
: Level(_level), GLNodes(makeGLNodes), SegsStuffed(0)
{
VertexMap = new FVertexMap (*this, Level.MinX, Level.MinY, Level.MaxX, Level.MaxY);
FindUsedVertices (Level.Vertices, Level.NumVertices);
@@ -228,13 +228,11 @@ class FNodeBuilder
fixed_t x, y;
};

FNodeBuilder (FLevel &level);
FNodeBuilder (FLevel &level,
TArray<FPolyStart> &polyspots, TArray<FPolyStart> &anchors,
bool makeGLNodes);
FNodeBuilder (FLevel &_level);
FNodeBuilder (FLevel &_level, TArray<FPolyStart> &polyspots, TArray<FPolyStart> &anchors, bool makeGLNodes);
~FNodeBuilder ();

void Extract(FLevelLocals &level);
void Extract(FLevelLocals &_level);
const int *GetOldVertexTable();

// These are used for building sub-BSP trees for polyobjects.
@@ -3756,7 +3756,7 @@ int DLevelScript::DoSpawn (int type, const DVector3 &pos, int tid, DAngle angle,
return 0;
}

actor = Spawn (&level, info, pos, ALLOW_REPLACE);
actor = Spawn (Level, info, pos, ALLOW_REPLACE);
if (actor != NULL)
{
ActorFlags2 oldFlags2 = actor->flags2;
@@ -4101,7 +4101,6 @@ void DLevelScript::DoSetActorProperty (AActor *actor, int property, int value)
{
return;
}
auto Level = &level;
switch (property)
{
case APROP_Health:
@@ -5309,7 +5308,6 @@ int DLevelScript::ScriptCall(AActor *activator, unsigned argc, int32_t *args)
int DLevelScript::CallFunction(int argCount, int funcIndex, int32_t *args)
{
AActor *actor;
auto Level = &level;
switch(funcIndex)
{
case ACSF_GetLineUDMFInt:
@@ -5673,7 +5671,7 @@ int DLevelScript::CallFunction(int argCount, int funcIndex, int32_t *args)
const char *seqname = Level->Behaviors.LookupString(args[1]);
if (seqname != NULL)
{
FPolyObj *poly = PO_GetPolyobj(&level, args[0]);
FPolyObj *poly = PO_GetPolyobj(Level, args[0]);
if (poly != NULL)
{
SN_StartSequence(poly, seqname, 0);
@@ -5684,7 +5682,7 @@ int DLevelScript::CallFunction(int argCount, int funcIndex, int32_t *args)

case ACSF_GetPolyobjX:
{
FPolyObj *poly = PO_GetPolyobj(&level, args[0]);
FPolyObj *poly = PO_GetPolyobj(Level, args[0]);
if (poly != NULL)
{
return DoubleToACS(poly->StartSpot.pos.X);
@@ -5694,7 +5692,7 @@ int DLevelScript::CallFunction(int argCount, int funcIndex, int32_t *args)

case ACSF_GetPolyobjY:
{
FPolyObj *poly = PO_GetPolyobj(&level, args[0]);
FPolyObj *poly = PO_GetPolyobj(Level, args[0]);
if (poly != NULL)
{
return DoubleToACS(poly->StartSpot.pos.Y);
@@ -6836,7 +6834,7 @@ int DLevelScript::RunScript ()

case SCRIPT_PolyWait:
// Wait for polyobj(s) to stop moving, then enter state running
if (!PO_Busy (&level, statedata))
if (!PO_Busy (Level, statedata))
{
state = SCRIPT_Running;
}
@@ -6874,7 +6872,6 @@ int DLevelScript::RunScript ()
const char *lookup;
int optstart = -1;
int temp;
auto Level = &level;

while (state == SCRIPT_Running)
{
@@ -181,7 +181,7 @@ void P_FindParticleSubsectors (FLevelLocals *Level)
for (uint16_t i = Level->ActiveParticles; i != NO_PARTICLE; i = Level->Particles[i].tnext)
{
// Try to reuse the subsector from the last portal check, if still valid.
if (Level->Particles[i].subsector == NULL) Level->Particles[i].subsector = R_PointInSubsector(&level, Level->Particles[i].Pos);
if (Level->Particles[i].subsector == NULL) Level->Particles[i].subsector = R_PointInSubsector(Level, Level->Particles[i].Pos);
int ssnum = Level->Particles[i].subsector->Index();
Level->Particles[i].snext = Level->ParticlesInSubsec[ssnum];
Level->ParticlesInSubsec[ssnum] = i;
@@ -258,7 +258,7 @@ void P_ThinkParticles (FLevelLocals *Level)
}

// Handle crossing a line portal
DVector2 newxy = P_GetOffsetPosition(&level, particle->Pos.X, particle->Pos.Y, particle->Vel.X, particle->Vel.Y);
DVector2 newxy = P_GetOffsetPosition(Level, particle->Pos.X, particle->Pos.Y, particle->Vel.X, particle->Vel.Y);
particle->Pos.X = newxy.X;
particle->Pos.Y = newxy.Y;
particle->Pos.Z += particle->Vel.Z;
Oops, something went wrong.

0 comments on commit 3b59afa

Please sign in to comment.