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

View file

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

View file

@ -1034,7 +1034,7 @@ local Ci = {
addkills = cmd(D)
/ (PLS".actors_killed="..PLS".actors_killed+%1;"..ACS".actorstayput=-1"),
addphealth = cmd(D)
/ format("_con._addphealth(%s,%s,%%1)", PLS"", SPS""),
/ format("_con._addphealth(%s,_aci,%%1)", PLS""),
angoff = cmd(D)
/ "spritext[_aci].angoff=%1",
debug = cmd(D)
@ -1143,7 +1143,7 @@ local Ci = {
activatebysector = cmd(R,R),
addlogvar = cmd(R),
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),
canseespr = cmd(R,R,W),
changespritesect = cmd(R,R),

View file

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

View file

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

View file

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

View file

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

View file

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