mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-25 03:00:46 +00:00
Lunatic: create game Lua state just before EVENT_NEWGAME, not in G_EnterLevel().
git-svn-id: https://svn.eduke32.com/eduke32@3951 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
d7e4d5afbf
commit
36c03b8610
2 changed files with 63 additions and 58 deletions
|
@ -39,6 +39,11 @@ ourvar = { ourvar2; 1, 2, 3, "qwe"; [true]=0, [false]=1 }
|
||||||
ourvar[#ourvar+1] = ourvar;
|
ourvar[#ourvar+1] = ourvar;
|
||||||
--]]
|
--]]
|
||||||
|
|
||||||
|
gameevent
|
||||||
|
{
|
||||||
|
"ENTERLEVEL",
|
||||||
|
|
||||||
|
function()
|
||||||
local vol, lev = gv.currentEpisode()+1, gv.currentLevel()+1
|
local vol, lev = gv.currentEpisode()+1, gv.currentLevel()+1
|
||||||
printf('volume=%d, level=%d', vol, lev)
|
printf('volume=%d, level=%d', vol, lev)
|
||||||
|
|
||||||
|
@ -86,7 +91,6 @@ if (vol==1 and lev==1) then -- E1L1
|
||||||
--actor = {}
|
--actor = {}
|
||||||
actor[562].flags = bit.bor(actor[562].flags, 2); -- pal 6 with goggles on front SEENINE
|
actor[562].flags = bit.bor(actor[562].flags, 2); -- pal 6 with goggles on front SEENINE
|
||||||
end
|
end
|
||||||
|
|
||||||
--[[
|
--[[
|
||||||
-- TODO: better API for all TROR things?
|
-- TODO: better API for all TROR things?
|
||||||
if (vol==1 and lev==8) then
|
if (vol==1 and lev==8) then
|
||||||
|
@ -100,6 +104,8 @@ if (vol==1 and lev==8) then
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
--]]
|
--]]
|
||||||
|
end
|
||||||
|
}
|
||||||
|
|
||||||
local unsafe = pcall(function() string.UNSAFE=true; end)
|
local unsafe = pcall(function() string.UNSAFE=true; end)
|
||||||
|
|
||||||
|
@ -193,8 +199,6 @@ player[0].wackedbyactor = -1 -- should succeed
|
||||||
checkfail("player[0].curr_weapon = -1", "Invalid weapon ID")
|
checkfail("player[0].curr_weapon = -1", "Invalid weapon ID")
|
||||||
player[0].curr_weapon = 1
|
player[0].curr_weapon = 1
|
||||||
|
|
||||||
printf('ceilingbunch of sector 0: %d', sector[0].ceilingbunch)
|
|
||||||
|
|
||||||
gameevent{gv.EVENT_JUMP,
|
gameevent{gv.EVENT_JUMP,
|
||||||
function(actori, playeri, dist)
|
function(actori, playeri, dist)
|
||||||
printf("jump i=%d p=%d d=%d", actori, playeri, dist)
|
printf("jump i=%d p=%d d=%d", actori, playeri, dist)
|
||||||
|
|
|
@ -1127,11 +1127,6 @@ static inline void prelevel(char g)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef LUNATIC
|
|
||||||
El_CreateGameState();
|
|
||||||
G_PostCreateGameState();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
i = headspritestat[STAT_DEFAULT];
|
i = headspritestat[STAT_DEFAULT];
|
||||||
while (i >= 0)
|
while (i >= 0)
|
||||||
{
|
{
|
||||||
|
@ -1502,6 +1497,12 @@ void G_NewGame(int32_t vn, int32_t ln, int32_t sk)
|
||||||
|
|
||||||
display_mirror = 0;
|
display_mirror = 0;
|
||||||
|
|
||||||
|
#ifdef LUNATIC
|
||||||
|
// NOTE: Lunatic state creation is relatively early. No map has yet been loaded.
|
||||||
|
// XXX: What about the cases where G_EnterLevel() is called without a preceding G_NewGame()?
|
||||||
|
El_CreateGameState();
|
||||||
|
G_PostCreateGameState();
|
||||||
|
#endif
|
||||||
VM_OnEvent(EVENT_NEWGAME, g_player[myconnectindex].ps->i, myconnectindex, -1, 0);
|
VM_OnEvent(EVENT_NEWGAME, g_player[myconnectindex].ps->i, myconnectindex, -1, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue