No start for player error after unconditional level exit

Forum rules
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.

Post a reply

Smilies
:D :) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :geek: :ugeek: :!: :?: :idea: :arrow: :| :mrgreen: :3: :wub: >:( :blergh:
View more smilies

BBCode is OFF
Smilies are ON

Topic review
   

Expand view Topic review: No start for player error after unconditional level exit

Re: No start for player error after unconditional level exit

by drfrag » Mon Jun 17, 2019 2:01 pm

Thanks very much!!! :wub:
In the end i fixed it myself changing the statics but your solution is cleaner. :)

Re: No start for player error after unconditional level exit

by _mental_ » Mon Jun 17, 2019 11:51 am

Pushed merged changes to legacy branch, 4f6ab52 and d801788.

No start for player error after unconditional level exit

by drfrag » Mon Jun 17, 2019 11:10 am

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 all

>	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 all

		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 all

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
 

Top