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,67 +39,73 @@ ourvar = { ourvar2; 1, 2, 3, "qwe"; [true]=0, [false]=1 }
|
||||||
ourvar[#ourvar+1] = ourvar;
|
ourvar[#ourvar+1] = ourvar;
|
||||||
--]]
|
--]]
|
||||||
|
|
||||||
local vol, lev = gv.currentEpisode()+1, gv.currentLevel()+1
|
gameevent
|
||||||
printf('volume=%d, level=%d', vol, lev)
|
{
|
||||||
|
"ENTERLEVEL",
|
||||||
|
|
||||||
---[[
|
function()
|
||||||
if (vol ~= 4) then
|
local vol, lev = gv.currentEpisode()+1, gv.currentLevel()+1
|
||||||
-- Tweak some sector pals.
|
printf('volume=%d, level=%d', vol, lev)
|
||||||
-- 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
|
|
||||||
-- loaded from the menu when no other level is loaded.
|
|
||||||
|
|
||||||
print('tweaking sector pals')
|
---[[
|
||||||
print('numsectors: ' .. gv.numsectors .. ' of ' .. gv.MAXSECTORS)
|
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
|
||||||
|
-- loaded from the menu when no other level is loaded.
|
||||||
|
|
||||||
local SF = sector.STAT
|
print('tweaking sector pals')
|
||||||
for i = 0, gv.numsectors/2 do
|
print('numsectors: ' .. gv.numsectors .. ' of ' .. gv.MAXSECTORS)
|
||||||
local sec = sector[i]
|
|
||||||
sec.floorpal = 1;
|
|
||||||
sector[i].floor.shade = sec.floor.shade + 4
|
|
||||||
sector[i].ceilingpal = 2;
|
|
||||||
local ceil = sec.ceiling
|
|
||||||
ceil.shade = sector[i].ceiling.shade + 8
|
|
||||||
ceil.statbits:flip(SF.SMOOSH)
|
|
||||||
sec.floorstatbits:flip(SF.SWAPXY)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if (vol==1 and lev==1) then -- E1L1
|
local SF = sector.STAT
|
||||||
print('tweaking some sprites 2')
|
for i = 0, gv.numsectors/2 do
|
||||||
local i = 562
|
local sec = sector[i]
|
||||||
spriteext[i].alpha = 0.5;
|
sec.floorpal = 1;
|
||||||
sprite[i].cstat = bit.bor(sprite[i].cstat, 2+512);
|
sector[i].floor.shade = sec.floor.shade + 4
|
||||||
spriteext[i].pitch = 128;
|
sector[i].ceilingpal = 2;
|
||||||
spriteext[i].roll = 256;
|
local ceil = sec.ceiling
|
||||||
|
ceil.shade = sector[i].ceiling.shade + 8
|
||||||
|
ceil.statbits:flip(SF.SMOOSH)
|
||||||
|
sec.floorstatbits:flip(SF.SWAPXY)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
i = 107 -- pistol ammo at rooftop
|
if (vol==1 and lev==1) then -- E1L1
|
||||||
spriteext[i].pitch = 128;
|
print('tweaking some sprites 2')
|
||||||
spriteext[i].roll = 256;
|
local i = 562
|
||||||
|
spriteext[i].alpha = 0.5;
|
||||||
|
sprite[i].cstat = bit.bor(sprite[i].cstat, 2+512);
|
||||||
|
spriteext[i].pitch = 128;
|
||||||
|
spriteext[i].roll = 256;
|
||||||
|
|
||||||
for spr in spritesofsect(307) do -- some fence sprites in E1L1
|
i = 107 -- pistol ammo at rooftop
|
||||||
printf('spr %d', spr)
|
spriteext[i].pitch = 128;
|
||||||
sprite[spr].pal = 6
|
spriteext[i].roll = 256;
|
||||||
end
|
|
||||||
|
|
||||||
--this is a problem
|
for spr in spritesofsect(307) do -- some fence sprites in E1L1
|
||||||
--actor = {}
|
printf('spr %d', spr)
|
||||||
actor[562].flags = bit.bor(actor[562].flags, 2); -- pal 6 with goggles on front SEENINE
|
sprite[spr].pal = 6
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--this is a problem
|
||||||
|
--actor = {}
|
||||||
|
actor[562].flags = bit.bor(actor[562].flags, 2); -- pal 6 with goggles on front SEENINE
|
||||||
|
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
|
||||||
print('tweaking bunch 1');
|
print('tweaking bunch 1');
|
||||||
-- trueror1.map
|
-- trueror1.map
|
||||||
for i in sectorsofbunch(1, gv.CEILING) do
|
for i in sectorsofbunch(1, gv.CEILING) do
|
||||||
sector[i].ceilingz = sector[i].ceilingz - 3*1024;
|
sector[i].ceilingz = sector[i].ceilingz - 3*1024;
|
||||||
end
|
end
|
||||||
for i in sectorsofbunch(1, gv.FLOOR) do
|
for i in sectorsofbunch(1, gv.FLOOR) do
|
||||||
sector[i].floorz = sector[i].floorz - 3*1024;
|
sector[i].floorz = sector[i].floorz - 3*1024;
|
||||||
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