Merge branch 'flicky-mapload-crash-fix' into 'next'

Flicky mapload crash fix (and other tmthing-related fixes)

Closes #81

See merge request STJr/SRB2!1522
This commit is contained in:
sphere 2021-06-01 14:58:01 -04:00
commit 69b6c409b5
2 changed files with 15 additions and 3 deletions

View file

@ -1062,48 +1062,56 @@ static int lib_pSceneryXYMovement(lua_State *L)
static int lib_pZMovement(lua_State *L)
{
mobj_t *actor = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
mobj_t *ptmthing = tmthing;
NOHUD
INLEVEL
if (!actor)
return LUA_ErrInvalid(L, "mobj_t");
lua_pushboolean(L, P_ZMovement(actor));
P_CheckPosition(actor, actor->x, actor->y);
P_SetTarget(&tmthing, ptmthing);
return 1;
}
static int lib_pRingZMovement(lua_State *L)
{
mobj_t *actor = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
mobj_t *ptmthing = tmthing;
NOHUD
INLEVEL
if (!actor)
return LUA_ErrInvalid(L, "mobj_t");
P_RingZMovement(actor);
P_CheckPosition(actor, actor->x, actor->y);
P_SetTarget(&tmthing, ptmthing);
return 0;
}
static int lib_pSceneryZMovement(lua_State *L)
{
mobj_t *actor = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
mobj_t *ptmthing = tmthing;
NOHUD
INLEVEL
if (!actor)
return LUA_ErrInvalid(L, "mobj_t");
lua_pushboolean(L, P_SceneryZMovement(actor));
P_CheckPosition(actor, actor->x, actor->y);
P_SetTarget(&tmthing, ptmthing);
return 1;
}
static int lib_pPlayerZMovement(lua_State *L)
{
mobj_t *actor = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
mobj_t *ptmthing = tmthing;
NOHUD
INLEVEL
if (!actor)
return LUA_ErrInvalid(L, "mobj_t");
P_PlayerZMovement(actor);
P_CheckPosition(actor, actor->x, actor->y);
P_SetTarget(&tmthing, ptmthing);
return 0;
}
@ -1490,11 +1498,13 @@ static int lib_pSpawnSkidDust(lua_State *L)
static int lib_pMovePlayer(lua_State *L)
{
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
mobj_t *ptmthing = tmthing;
NOHUD
INLEVEL
if (!player)
return LUA_ErrInvalid(L, "player_t");
P_MovePlayer(player);
P_SetTarget(&tmthing, ptmthing);
return 0;
}

View file

@ -4221,7 +4221,7 @@ boolean P_LoadLevel(boolean fromnetsave, boolean reloadinggamestate)
P_ResetWaypoints();
P_MapStart();
P_MapStart(); // tmthing can be used starting from this point
if (!P_LoadMapFromFile())
return false;
@ -4274,8 +4274,6 @@ boolean P_LoadLevel(boolean fromnetsave, boolean reloadinggamestate)
// clear special respawning que
iquehead = iquetail = 0;
P_MapEnd();
// Remove the loading shit from the screen
if (rendermode != render_none && !(titlemapinaction || reloadinggamestate))
F_WipeColorFill(levelfadecol);
@ -4295,6 +4293,8 @@ boolean P_LoadLevel(boolean fromnetsave, boolean reloadinggamestate)
P_RunCachedActions();
P_MapEnd(); // tmthing is no longer needed from this point onwards
// Took me 3 hours to figure out why my progression kept on getting overwritten with the titlemap...
if (!titlemapinaction)
{
@ -4318,7 +4318,9 @@ boolean P_LoadLevel(boolean fromnetsave, boolean reloadinggamestate)
G_CopyTiccmd(&players[i].cmd, &netcmds[buf][i], 1);
}
P_PreTicker(2);
P_MapStart(); // just in case MapLoad modifies tmthing
LUAh_MapLoad();
P_MapEnd(); // just in case MapLoad modifies tmthing
}
// No render mode or reloading gamestate, stop here.