[Fixed] No start for player error after unconditional level exit

Bugs that have been investigated and resolved somehow.

Moderator: GZDoom Developers

No start for player error after unconditional level exit

Postby drfrag » Mon Jun 17, 2019 12:10 pm

After trying to port "- exported unconditional level exit to ZScript" now with DTS-T.pk3 after killing the boss brain in MAP16 it warps to MAP17 but gives a "no start for player 1 found" error in G_DoLoadLevel. Both start and pawndup are null in G_FinishTravel.
level.AllPlayerStarts.Size() == 0 in G_PickPlayerStart.
I don't know why it's happening. Any ideas? I need help with this, it's an important bug. Thanks.

Trace:
Code: Select allExpand view
>   gzdoom.exe!G_FinishTravel() Line 1389   C++
    gzdoom.exe!G_DoLoadLevel(int position, bool autosave, bool newGame) Line 1087   C++
    gzdoom.exe!G_DoWorldDone() Line 1293   C++
    gzdoom.exe!G_Ticker() Line 1089   C++
    gzdoom.exe!TryRunTics() Line 1995   C++
    gzdoom.exe!D_DoomLoop() Line 1029   C++
    gzdoom.exe!D_DoomMain() Line 2715   C++
    gzdoom.exe!DoMain(HINSTANCE__ * hInstance) Line 991   C++
    gzdoom.exe!wWinMain(HINSTANCE__ * hInstance, HINSTANCE__ * nothing, wchar_t * cmdline, int nCmdShow) Line 1323   C++

Locals:
Code: Select allExpand view
      autosave   true   bool
      i   8   int
      lastposition   2047108640   int
+      mapname   {Chars=0x000001a679033c3c "map17" }   FString
      newGame   false   bool
      oldgs   GS_LEVEL (0)   gamestate_t
      pnumerr   1   int
      position   2047108640   int

Patch:
Code: Select allExpand view
diff --git a/src/g_level.cpp b/src/g_level.cpp
index 9c74c6232..a1c1899c9 100644
--- a/src/g_level.cpp
+++ b/src/g_level.cpp
@@ -720,12 +720,39 @@ void G_ExitLevel (int position, bool keepFacing)
    G_ChangeLevel(G_GetExitMap(), position, keepFacing ? CHANGELEVEL_KEEPFACING : 0);
 }
 
+static void LevelLocals_ExitLevel(int position, bool keepFacing)
+{
+   G_ExitLevel(position, keepFacing);
+}
+
+DEFINE_ACTION_FUNCTION_NATIVE(FLevelLocals, ExitLevel, LevelLocals_ExitLevel)
+{
+   PARAM_PROLOGUE;
+   PARAM_INT(position);
+   PARAM_INT(keepFacing);
+   G_ExitLevel(position, keepFacing);
+   return 0;
+}
+
 void G_SecretExitLevel (int position)
 {
    level.flags3 |= LEVEL3_EXITSECRETUSED;
    G_ChangeLevel(G_GetSecretExitMap(), position, 0);
 }
 
+static void LevelLocals_SecretExitLevel(int position)
+{
+   G_SecretExitLevel(position);
+}
+
+DEFINE_ACTION_FUNCTION_NATIVE(FLevelLocals, SecretExitLevel, LevelLocals_SecretExitLevel)
+{
+   PARAM_PROLOGUE;
+   PARAM_INT(position);
+   G_SecretExitLevel(position);
+   return 0;
+}
+
 //==========================================================================
 //
 //
diff --git a/wadsrc/static/zscript/base.zs b/wadsrc/static/zscript/base.zs
index 41c2b3b14..dabde4256 100644
--- a/wadsrc/static/zscript/base.zs
+++ b/wadsrc/static/zscript/base.zs
@@ -768,6 +768,9 @@ struct LevelLocals native
    {
       return Floor.CreateFloor(sec, floortype, ln, speed, height, crush, change, crushmode, hereticlower);
    }
+
+   native void ExitLevel(int position, bool keepFacing);
+   native void SecretExitLevel(int position);
 }
 
 struct StringTable native
 
User avatar
drfrag
I.R developer, I.R smart
Vintage GZDoom Developer
 
Joined: 23 Apr 2004
Location: Spain

Re: No start for player error after unconditional level exit

Postby _mental_ » Mon Jun 17, 2019 12:51 pm

Pushed merged changes to legacy branch, 4f6ab52 and d801788.
_mental_
 
 
 
Joined: 07 Aug 2011

Re: No start for player error after unconditional level exit

Postby drfrag » Mon Jun 17, 2019 3:01 pm

Thanks very much!!! :wub:
In the end i fixed it myself changing the statics but your solution is cleaner. :)
User avatar
drfrag
I.R developer, I.R smart
Vintage GZDoom Developer
 
Joined: 23 Apr 2004
Location: Spain


Return to Closed Bugs

Who is online

Users browsing this forum: Awario [RSS], MSN [Bot] and 1 guest