Lunatic: a couple of small changes.

git-svn-id: https://svn.eduke32.com/eduke32@3380 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2013-01-06 18:56:45 +00:00
parent 87bd2c762e
commit 51c5afaae6
8 changed files with 29 additions and 14 deletions

View file

@ -522,7 +522,7 @@ function _getinventory(ps, inv, i)
end end
end end
function _addphealth(ps, spr, hlthadd) function _addphealth(ps, aci, hlthadd)
if (ps.newowner >= 0) then if (ps.newowner >= 0) then
ffiC.G_ClearCameraView(ps) ffiC.G_ClearCameraView(ps)
end end
@ -531,7 +531,7 @@ function _addphealth(ps, spr, hlthadd)
return return
end end
local notatomic = (spr.picnum ~= D.ATOMICHEALTH) local notatomic = (sprite[aci].picnum ~= D.ATOMICHEALTH)
local j = sprite[ps.i].extra local j = sprite[ps.i].extra
if (notatomic and j > ps.max_player_health and hlthadd > 0) then if (notatomic and j > ps.max_player_health and hlthadd > 0) then
@ -555,8 +555,8 @@ function _addphealth(ps, spr, hlthadd)
if (hlthadd > 0) then if (hlthadd > 0) then
local qmaxhlth = bit.rshift(ps.max_player_health, 2) local qmaxhlth = bit.rshift(ps.max_player_health, 2)
if (j-hlthadd < qmaxhlth and j >= qmaxhlth) then if (j-hlthadd < qmaxhlth and j >= qmaxhlth) then
-- TODO -- XXX: DUKE_GOTHEALTHATLOW
--A_PlaySound(DUKE_GOTHEALTHATLOW, ps->i) _sound(229, aci)
end end
ps.last_extra = j ps.last_extra = j

View file

@ -1092,7 +1092,7 @@ local function our_gameevent(event, func)
if (event:sub(1,6) ~= "EVENT_") then if (event:sub(1,6) ~= "EVENT_") then
event = "EVENT_"..event event = "EVENT_"..event
end end
local eventidx = con_lang.labels.EVENT[event] local eventidx = con_lang.EVENT[event]
if (eventidx == nil) then if (eventidx == nil) then
errorf(2, "gameevent: invalid event label %q", event) errorf(2, "gameevent: invalid event label %q", event)
end end
@ -1309,6 +1309,12 @@ DBG_.printkv = printkv
DBG_.loadstring = loadstring DBG_.loadstring = loadstring
DBG_.serializeGamevars = serializeGamevars DBG_.serializeGamevars = serializeGamevars
DBG_.loadGamevarsString = loadGamevarsString DBG_.loadGamevarsString = loadGamevarsString
DBG_.oom = function()
local s = "1"
for i=1,math.huge do
s = s..s
end
end
---=== Finishing environment setup ===--- ---=== Finishing environment setup ===---

View file

@ -1034,7 +1034,7 @@ local Ci = {
addkills = cmd(D) addkills = cmd(D)
/ (PLS".actors_killed="..PLS".actors_killed+%1;"..ACS".actorstayput=-1"), / (PLS".actors_killed="..PLS".actors_killed+%1;"..ACS".actorstayput=-1"),
addphealth = cmd(D) addphealth = cmd(D)
/ format("_con._addphealth(%s,%s,%%1)", PLS"", SPS""), / format("_con._addphealth(%s,_aci,%%1)", PLS""),
angoff = cmd(D) angoff = cmd(D)
/ "spritext[_aci].angoff=%1", / "spritext[_aci].angoff=%1",
debug = cmd(D) debug = cmd(D)
@ -1143,7 +1143,7 @@ local Ci = {
activatebysector = cmd(R,R), activatebysector = cmd(R,R),
addlogvar = cmd(R), addlogvar = cmd(R),
addlog = cmd() * #sp1, addlog = cmd() * #sp1,
addweaponvar = cmd(R,R), -- exec SPECIAL HANDLING! addweaponvar = cmd(R,R), -- NLCF
cansee = cmd(R,R,R,R,R,R,R,R,W), cansee = cmd(R,R,R,R,R,R,R,R,W),
canseespr = cmd(R,R,W), canseespr = cmd(R,R,W),
changespritesect = cmd(R,R), changespritesect = cmd(R,R),

View file

@ -80,6 +80,6 @@ function compinside(n)
end end
print("====================") print("====================")
print("inside(): " .. tostring(sti:getstats())) print("inside(): " .. sti:getstatstr())
print("contains(): " .. tostring(sts:getstats())) print("contains(): " .. sts:getstatstr())
end end

View file

@ -85,8 +85,8 @@ function randwalk(N, spritenum, minlen, maxlen, randofs, funci, logfn)
minlen, maxlen, randofs, logfn) minlen, maxlen, randofs, logfn)
printf("-- Times [ms] (total=%f)", N*stallres.mean) printf("-- Times [ms] (total=%f)", N*stallres.mean)
print("All: ".. tostring(stallres)) print("All: ".. tostring(stallres))
print("Succeeded: ".. tostring(st.succ:getstats())) print("Succeeded: ".. st.succ:getstatstr())
print("Failed: ".. tostring(st.fail:getstats())) print("Failed: ".. st.fail:getstatstr())
if (logfn ~= nil) then if (logfn ~= nil) then
local logfile, errmsg = io.open(logfn, "w") local logfile, errmsg = io.open(logfn, "w")

View file

@ -56,8 +56,8 @@ if (numreps > 1) then
local key = keys[i] local key = keys[i]
if (unit[key] ~= nil) then if (unit[key] ~= nil) then
print("== "..key.." times:") print("== "..key.." times:")
print(" "..tostring(st[key]:getstats()).." ["..unit[key].."]") print(" "..st[key]:getstatstr().." ["..unit[key].."]")
print(" "..tostring(stperx[key]:getstats()).." ["..unitperx[key].."]") print(" "..stperx[key]:getstatstr().." ["..unitperx[key].."]")
end end
end end
end end

View file

@ -5,6 +5,8 @@ local ffi = require("ffi")
local math = require("math") local math = require("math")
local string = require("string") local string = require("string")
local tostring = tostring
module(...) module(...)
@ -75,6 +77,10 @@ local mt = {
return rstatres(s.n, s.m, var, math.sqrt(var), s.min, s.max) return rstatres(s.n, s.m, var, math.sqrt(var), s.min, s.max)
end, end,
getstatstr = function(s)
return tostring(s:getstats())
end,
reset = function(s) reset = function(s)
s.n = 0 s.n = 0
s.m, s.s, s.min, s.max = NaN, NaN, NaN, NaN s.m, s.s, s.min, s.max = NaN, NaN, NaN, NaN

View file

@ -204,6 +204,7 @@ gameevent(gv.EVENT_JUMP,
gameevent("JUMP", gameevent("JUMP",
function(actori, playeri, dist) function(actori, playeri, dist)
print("I'm first!") print("I'm first!")
-- DBG_.oom()
end end
) )
@ -279,7 +280,7 @@ gameactor(1680, TROOPSTRENGTH, "TROOPSTAND", -- LIZTROOP
hs:add(1000*(gv.gethitickms()-t)) hs:add(1000*(gv.gethitickms()-t))
if (hs.n == 300) then if (hs.n == 300) then
printf("hitscan: %s", tostring(hs:getstats())) printf("hitscan: %s", hs:getstatstr())
hs:reset() hs:reset()
error("greetings from LIZTROOP actor") error("greetings from LIZTROOP actor")
end end
@ -311,6 +312,8 @@ function check_sector_idx()
end end
spritesofsect(0) spritesofsect(0)
--DBG_.oom()
-- This will complain about wrong usage of 'error'. In particular, -- This will complain about wrong usage of 'error'. In particular,
-- the nil must not propagate to C! -- the nil must not propagate to C!
error(nil) error(nil)