Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into newtimercode4
Browse files Browse the repository at this point in the history
  • Loading branch information
Rachael Alexanderson committed Nov 16, 2017
2 parents e418663 + 0dcb1fe commit e867d75
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 6 deletions.
21 changes: 15 additions & 6 deletions src/g_level.cpp
Expand Up @@ -129,7 +129,7 @@ int starttime;
extern FString BackupSaveName;

bool savegamerestore;
int finishstate;
int finishstate = FINISH_NoHub;

extern int mousex, mousey;
extern bool sendpause, sendsave, sendturn180, SendLand;
Expand Down Expand Up @@ -852,6 +852,8 @@ void G_DoCompleted (void)
level.maptime = 0;
}

finishstate = mode;

if (!deathmatch &&
((level.flags & LEVEL_NOINTERMISSION) ||
((nextcluster == thiscluster) && (thiscluster->flags & CLUSTER_HUB) && !(thiscluster->flags & CLUSTER_ALLOWINTERMISSION))))
Expand All @@ -861,7 +863,6 @@ void G_DoCompleted (void)
}

gamestate = GS_INTERMISSION;
finishstate = mode;
viewactive = false;
automapactive = false;

Expand Down Expand Up @@ -1039,12 +1040,20 @@ void G_DoLoadLevel (int position, bool autosave)
{
players[ii].camera = players[ii].mo;
}
if (!savegamerestore)

if (savegamerestore)
{
continue;
}

const bool fromSnapshot = level.FromSnapshot;
E_PlayerEntered(ii, fromSnapshot && finishstate == FINISH_SameHub);

if (fromSnapshot)
{
E_PlayerEntered(ii, finishstate == FINISH_SameHub);
// ENTER scripts are being handled when the player gets spawned, this cannot be changed due to its effect on voodoo dolls.
FBehavior::StaticStartTypedScripts(SCRIPT_Return, players[ii].mo, true);
}
// ENTER scripts are being handled when the player gets spawned, this cannot be changed due to its effect on voodoo dolls.
if (level.FromSnapshot && !savegamerestore) FBehavior::StaticStartTypedScripts(SCRIPT_Return, players[ii].mo, true);
}
}

Expand Down
22 changes: 22 additions & 0 deletions src/p_things.cpp
Expand Up @@ -945,3 +945,25 @@ int P_Thing_Warp(AActor *caller, AActor *reference, double xofs, double yofs, do
caller->SetOrigin(old, true);
return false;
}

//==========================================================================
//
// A_Warp
//
//==========================================================================

DEFINE_ACTION_FUNCTION(AActor, Warp)
{
PARAM_SELF_PROLOGUE(AActor)
PARAM_OBJECT_DEF(destination, AActor)
PARAM_FLOAT_DEF(xofs)
PARAM_FLOAT_DEF(yofs)
PARAM_FLOAT_DEF(zofs)
PARAM_ANGLE_DEF(angle)
PARAM_INT_DEF(flags)
PARAM_FLOAT_DEF(heightoffset)
PARAM_FLOAT_DEF(radiusoffset)
PARAM_ANGLE_DEF(pitch)

ACTION_RETURN_INT(!!P_Thing_Warp(self, destination, xofs, yofs, zofs, angle, flags, heightoffset, radiusoffset, pitch));
}
9 changes: 9 additions & 0 deletions src/scripting/thingdef_data.cpp
Expand Up @@ -1225,6 +1225,15 @@ DEFINE_ACTION_FUNCTION(FStringStruct, Truncate)
return 0;
}

DEFINE_ACTION_FUNCTION(FStringStruct, Remove)
{
PARAM_SELF_STRUCT_PROLOGUE(FString);
PARAM_UINT(index);
PARAM_UINT(remlen);
self->Remove(index, remlen);
return 0;
}

// CharAt and CharCodeAt is how JS does it, and JS is similar here in that it doesn't have char type as int.
DEFINE_ACTION_FUNCTION(FStringStruct, CharAt)
{
Expand Down
1 change: 1 addition & 0 deletions wadsrc/static/zscript/actor.txt
Expand Up @@ -683,6 +683,7 @@ class Actor : Thinker native
native float AccuracyFactor();
native bool MorphMonster (Class<Actor> spawntype, int duration, int style, Class<Actor> enter_flash, Class<Actor> exit_flash);
action native void SetCamera(Actor cam, bool revert = false);
native bool Warp(Actor dest, double xofs = 0, double yofs = 0, double zofs = 0, double angle = 0, int flags = 0, double heightoffset = 0, double radiusoffset = 0, double pitch = 0);

// DECORATE compatible functions
native clearscope int CountInv(class<Inventory> itemtype, int ptr_select = AAPTR_DEFAULT) const;
Expand Down
1 change: 1 addition & 0 deletions wadsrc/static/zscript/base.txt
Expand Up @@ -684,6 +684,7 @@ struct StringStruct native
native String Left(int len) const;
native String Mid(int pos = 0, int len = 2147483647) const;
native void Truncate(int newlen);
native void Remove(int index, int remlen);
native String CharAt(int pos) const;
native int CharCodeAt(int pos) const;
native String Filter();
Expand Down

0 comments on commit e867d75

Please sign in to comment.