LunaCON: strip dir prefixes on file-not-found; _getpname, ud.m_player_skill.

git-svn-id: https://svn.eduke32.com/eduke32@3862 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2013-06-07 14:26:34 +00:00
parent 16b3cb6a42
commit bd49bc7bbd
4 changed files with 31 additions and 13 deletions

View file

@ -841,9 +841,10 @@ local UserdefLabels = {
idplayers = UDRO".idplayers",
level_number = { UD".level_number", UD":set_level_number(%%s)" },
lockout = UDRO".lockout",
m_player_skill = UDRO".m_player_skill",
m_volume_number = UDRO".m_volume_number",
pause_on = UDRO".pause_on",
player_skill = UD".player_skill",
m_volume_number = UDRO".m_volume_number",
mouseflip = UDRO".mouseflip",
multimode = { "1" },
noexits = UDRO".noexits",

View file

@ -308,7 +308,7 @@ local int16_st = ffi.typeof "struct { int16_t s; }"
function _shoot(i, tilenum, zvel)
check_sprite_idx(i)
check_sector_idx(sprite[i].sectnum) -- accessed in A_ShootWithZvel
check_sector_idx(ffiC.sprite[i].sectnum) -- accessed in A_ShootWithZvel
check_tile_idx(tilenum)
zvel = zvel and int16_st(zvel).s or 0x80000000 -- SHOOT_HARDCODED_ZVEL
@ -768,6 +768,13 @@ function _qgetsysstr(qdst, what, pli)
end
end
function _getpname(qnum, pli)
bcheck.quote_idx(qnum, true)
check_player_idx(pli)
local uname = ffiC.g_player[pli].user_name
ffiC.C_DefineQuote(qnum, (uname[0] ~= 0) and uname or tostring(pli))
end
-- switch statement support
function _switch(swtab, testval, aci,pli,dist)
@ -969,7 +976,8 @@ end
-- NOTE: function args of the C function have overloaded meaning
function _A_Spawn(j, pn)
local bound_check = sector[sprite[j].sectnum] -- two in one whack
check_sprite_idx(j)
check_sector_idx(ffiC.sprite[j].sectnum)
check_tile_idx(pn)
return CF.A_Spawn(j, pn)
end
@ -1143,7 +1151,7 @@ function _A_RadiusDamage(i, r, hp1, hp2, hp3, hp4)
end
function _testkey(pli, synckey)
local bound_check = player[pli]
check_player_idx(pli)
if (synckey >= 32ULL) then
error("Invalid argument #2 to _testkey: must be in [0..31]", 2)
end

View file

@ -830,18 +830,18 @@ local function do_include_file(dirname, filename, isroot)
local io = require("io")
local fd, msg = io.open(dirname..filename)
if (fd == nil and not isroot) then
while (fd == nil and not isroot and filename:find("/")) do
-- strip up to and including first slash:
filename = filename:gsub("^.-/", "")
fd, msg = io.open(dirname..filename)
end
-- As a last resort, try the "default directory"
if (fd==nil and g_defaultDir) then
-- strip up to and including last slash (if any):
filename = filename:gsub("^.*/", "")
dirname = g_defaultDir.."/"
fd, msg = io.open(dirname..filename)
end
-- As a last resort, try the "default directory"
if (fd==nil and g_defaultDir) then
-- strip up to and including last slash (if any):
filename = filename:gsub("^.*/", "")
dirname = g_defaultDir.."/"
fd, msg = io.open(dirname..filename)
end
if (fd == nil) then
@ -2280,7 +2280,9 @@ local Cinner = {
getkeyname = cmd(R,R,R)
/ "_con._getkeyname(%1,%2,%3)",
getpname = cmd(R,R) -- THISACTOR
/ handle.NYI,
/ function(qnum, pli)
return format("_con._getpname(%s,%s)", qnum, thisactor_to_pli(pli))
end,
-- array stuff
-- TODO: handle system gamearrays. Right now, the generated code will be wrong.

View file

@ -88,6 +88,13 @@ onevent EVENT_ENTERLEVEL
userquote 400
endevent
// Test of 'getpname' command.
onevent EVENT_JUMP
getpname 400 THISACTOR
userquote 400
endevent
// Following code by Hendricks266, from
// http://forums.duke4.net/topic/1382-duke-64-mod-thread/page__view__findpost__p__150497
gamevar temp 0 0