mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-11 07:11:39 +00:00
Lunatic savegames: store g_playerWeapon[][], fix 'require' with submodules.
git-svn-id: https://svn.eduke32.com/eduke32@3883 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
4a49da94c1
commit
d43cfe6232
4 changed files with 26 additions and 7 deletions
|
@ -1,6 +1,7 @@
|
|||
-- Bound-checking functions for engine and game "things".
|
||||
|
||||
local ffiC = require("ffi").C
|
||||
local type = type
|
||||
local error = error
|
||||
|
||||
local con_lang = require("con_lang")
|
||||
|
@ -97,5 +98,10 @@ function bcheck.top_level(funcname)
|
|||
end
|
||||
end
|
||||
|
||||
function bcheck.number(val)
|
||||
if (type(val)~="number") then
|
||||
error("invalid argument: must be a number", 3)
|
||||
end
|
||||
end
|
||||
|
||||
return bcheck
|
||||
|
|
|
@ -178,6 +178,7 @@ local check_sector_idx, check_tile_idx = bcheck.sector_idx, bcheck.tile_idx
|
|||
local check_sprite_idx = bcheck.sprite_idx
|
||||
local check_weapon_idx, check_inventory_idx = bcheck.weapon_idx, bcheck.inventory_idx
|
||||
local check_sound_idx = bcheck.sound_idx
|
||||
local check_number = bcheck.number
|
||||
|
||||
bcarray.new("int16_t", 64, "loogie", "int16_x_64") -- TODO: randomize member names
|
||||
bcarray.new("int16_t", ffiC.MAX_WEAPONS, "weapon", "int16_x_MAX_WEAPONS", WEAPON_NAMES)
|
||||
|
@ -1082,6 +1083,8 @@ local weapondata_mt = {
|
|||
-- Set to 'true' if we set a tile or sound member.
|
||||
local didit = false
|
||||
|
||||
check_number(val)
|
||||
|
||||
if (string.match(member, "sound")) then
|
||||
if (val < 0) then
|
||||
val = 0 -- Set to 0 if oob (e.g. CrackDown).
|
||||
|
@ -1896,7 +1899,8 @@ do
|
|||
|
||||
-- XXX: System gamevars?
|
||||
for modname, modvars in pairs(module_gamevars) do
|
||||
sb:addrawf("M=require%q", modname)
|
||||
-- NOTE: when emitting 'require' code, reverse '.' -> '/' substitution.
|
||||
sb:addrawf("M=require%q", modname:gsub("/","."))
|
||||
for i=1,#modvars do
|
||||
local varname = modvars[i]
|
||||
-- Serialize gamevar named 'varname' from module named 'modname'.
|
||||
|
|
|
@ -221,6 +221,8 @@ gameevent
|
|||
end
|
||||
}
|
||||
|
||||
local D = require("CON.DEFS")
|
||||
|
||||
-- test event chaining
|
||||
gameevent
|
||||
{
|
||||
|
@ -232,8 +234,13 @@ gameevent
|
|||
local ps = player[playeri]
|
||||
print("\n--- I'm first!")
|
||||
-- DBG_.oom()
|
||||
ps.weapon.PISTOL.shoots = 2605 -- RPG
|
||||
ps.weapon[gv.PISTOL_WEAPON].firesound = 351 -- thunder
|
||||
local pistol = ps.weapon.PISTOL
|
||||
if (pistol.shoots ~= D.RPG) then
|
||||
pistol.shoots = D.RPG
|
||||
else
|
||||
pistol.shoots = D.SHOTSPARK1
|
||||
end
|
||||
ps.weapon[gv.PISTOL_WEAPON].firesound = D.LIGHTNING_SLAP
|
||||
|
||||
-- XXX: provide either named constants or methods?
|
||||
ps.pipebombControl = 2
|
||||
|
@ -307,7 +314,7 @@ gameevent
|
|||
player[0].weapon.SHOTGUN.shoots = 1653
|
||||
local proj = projectile[1653]
|
||||
proj.drop = 0
|
||||
proj:set_trail(2329) -- SMALLSMOKE
|
||||
proj:set_trail(D.SMALLSMOKE)
|
||||
|
||||
t = gv.gethitickms()
|
||||
local N=1
|
||||
|
@ -333,6 +340,7 @@ gameevent
|
|||
-- N=100: about 160 us * 100 = about 16 ms
|
||||
|
||||
-- Make the DUKECAR in E1L1 into a zombie actor (temporarily)
|
||||
-- NOTE: Use static value (not the one from 'D').
|
||||
if (sprite[24].picnum==2491) then
|
||||
sprite.changestat(24, actor.STAT.ZOMBIEACTOR)
|
||||
end
|
||||
|
@ -392,7 +400,6 @@ con.ai("AITEMP", "TROOPFLINTCH", "SHRUNKVELS", 0)
|
|||
|
||||
local TROOPSTRENGTH = 30
|
||||
|
||||
local D = require("CON.DEFS")
|
||||
local AF = actor.FLAGS
|
||||
local CS = sprite.CSTAT
|
||||
|
||||
|
@ -505,7 +512,7 @@ gameevent
|
|||
|
||||
function(aci)
|
||||
local tspr = atsprite[aci]
|
||||
if (tspr:getspr().picnum==1680) then
|
||||
if (tspr:getspr().picnum==D.LIZTROOP) then
|
||||
local tspr2 = tspr:dup()
|
||||
if (tspr2) then
|
||||
tspr2.x = tspr2.x + 512*math.cos(gv.totalclock/60)
|
||||
|
|
|
@ -1038,7 +1038,9 @@ static const dataspec_t svgm_anmisc[] =
|
|||
{ DS_NOCHK|DS_DYNAMIC|DS_CNT(g_numQuoteRedefinitions), &savegame_quoteredefs, MAXQUOTELEN, (intptr_t)&g_numQuoteRedefinitions },
|
||||
{ DS_NOCHK|DS_LOADFN, (void *)&sv_quoteredefload, 0, 1 },
|
||||
{ DS_NOCHK|DS_SAVEFN|DS_LOADFN, (void *)&sv_postquoteredef, 0, 1 },
|
||||
|
||||
#ifdef LUNATIC
|
||||
{ 0, g_playerWeapon, sizeof(weapondata_t), MAXPLAYERS*MAX_WEAPONS },
|
||||
#endif
|
||||
{ DS_SAVEFN, (void *)&sv_restsave, 0, 1 },
|
||||
{ 0, savegame_restdata, 1, sizeof(savegame_restdata) }, // sz/cnt swapped for kdfread
|
||||
{ DS_LOADFN, (void *)&sv_restload, 0, 1 },
|
||||
|
|
Loading…
Reference in a new issue