mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-24 10:40: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,11 +39,16 @@ ourvar = { ourvar2; 1, 2, 3, "qwe"; [true]=0, [false]=1 }
|
|||
ourvar[#ourvar+1] = ourvar;
|
||||
--]]
|
||||
|
||||
local vol, lev = gv.currentEpisode()+1, gv.currentLevel()+1
|
||||
printf('volume=%d, level=%d', vol, lev)
|
||||
gameevent
|
||||
{
|
||||
"ENTERLEVEL",
|
||||
|
||||
---[[
|
||||
if (vol ~= 4) then
|
||||
function()
|
||||
local vol, lev = gv.currentEpisode()+1, gv.currentLevel()+1
|
||||
printf('volume=%d, level=%d', vol, lev)
|
||||
|
||||
---[[
|
||||
if (vol ~= 4) then
|
||||
-- Tweak some sector pals.
|
||||
-- NOTE: you're not really supposed to modify game state from Lua file
|
||||
-- scope! This is for testing only! E.g. it will fail if a savegame is
|
||||
|
@ -63,9 +68,9 @@ if (vol ~= 4) then
|
|||
ceil.statbits:flip(SF.SMOOSH)
|
||||
sec.floorstatbits:flip(SF.SWAPXY)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if (vol==1 and lev==1) then -- E1L1
|
||||
if (vol==1 and lev==1) then -- E1L1
|
||||
print('tweaking some sprites 2')
|
||||
local i = 562
|
||||
spriteext[i].alpha = 0.5;
|
||||
|
@ -85,11 +90,10 @@ if (vol==1 and lev==1) then -- E1L1
|
|||
--this is a problem
|
||||
--actor = {}
|
||||
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?
|
||||
if (vol==1 and lev==8) then
|
||||
-- TODO: better API for all TROR things?
|
||||
if (vol==1 and lev==8) then
|
||||
print('tweaking bunch 1');
|
||||
-- trueror1.map
|
||||
for i in sectorsofbunch(1, gv.CEILING) do
|
||||
|
@ -98,8 +102,10 @@ if (vol==1 and lev==8) then
|
|||
for i in sectorsofbunch(1, gv.FLOOR) do
|
||||
sector[i].floorz = sector[i].floorz - 3*1024;
|
||||
end
|
||||
end
|
||||
end
|
||||
--]]
|
||||
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")
|
||||
player[0].curr_weapon = 1
|
||||
|
||||
printf('ceilingbunch of sector 0: %d', sector[0].ceilingbunch)
|
||||
|
||||
gameevent{gv.EVENT_JUMP,
|
||||
function(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];
|
||||
while (i >= 0)
|
||||
{
|
||||
|
@ -1502,6 +1497,12 @@ void G_NewGame(int32_t vn, int32_t ln, int32_t sk)
|
|||
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue