LunaCON: make mail, money, paper be affected by tile remapping, fix one printf.

git-svn-id: https://svn.eduke32.com/eduke32@3881 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2013-06-13 17:11:06 +00:00
parent 6f6fbf0f04
commit 878ba20af9
3 changed files with 25 additions and 16 deletions

View file

@ -166,6 +166,9 @@ local check_sprite_idx = bcheck.sprite_idx
local check_player_idx = bcheck.player_idx
local check_sound_idx = bcheck.sound_idx
-- Will contain [<label>]=number mappings after CON translation.
local D = { true }
local function krandand(mask)
return bit.band(ffiC.krand(), mask)
@ -293,14 +296,17 @@ end
-- A_SpawnMultiple clone
-- ow: parent sprite number
function _spawnmany(ow, tilenum, n)
local spr = sprite[ow]
function _spawnmany(ow, label, n)
local tilenum = D[label]
if (tilenum ~= nil) then
local spr = sprite[ow]
for i=n,1, -1 do
local j = insertsprite{ tilenum, spr^(ffiC.krand()%(47*256)), spr.sectnum, ow, 5,
shade=-32, xrepeat=8, yrepeat=8, ang=krandand(2047) }
_spawnexisting(j)
sprite[j].cstat = krandand(8+4)
for i=n,1, -1 do
local j = insertsprite{ tilenum, spr^(ffiC.krand()%(47*256)), spr.sectnum, ow, 5,
shade=-32, xrepeat=8, yrepeat=8, ang=krandand(2047) }
_spawnexisting(j)
sprite[j].cstat = krandand(8+4)
end
end
end
@ -858,9 +864,6 @@ end
---=== DEFINED LABELS ===---
-- Will contain [<label>]=number mappings after CON translation.
local D = { true }
-- Check if <picnum> equals to the number defined by <label> from CON.
-- If there is no such label, return nil.
local function ispic(picnum, label)

View file

@ -68,8 +68,9 @@ local function match_until(matchsp, untilsp) -- (!untilsp matchsp)* in PEG
return (matchsp - Pat(untilsp))^0
end
local format = string.format
--[[
local function format(fmt, ...)
format = function(fmt, ...)
local ok, res = pcall(string.format, fmt, ...)
if (not ok) then
error(string.format("FAILED format(%q, ...) | message: %s", fmt, res))
@ -77,7 +78,6 @@ local function format(fmt, ...)
return res
end
--]]
local format = string.format
local function printf(fmt, ...)
print(format(fmt, ...))
@ -826,7 +826,7 @@ local function do_include_file(dirname, filename, isroot)
assert(type(filename)=="string")
if (g_have_file[filename] ~= nil) then
printf("[%d] Fatal error: infinite loop including \"%s\"", filename)
printf("[%d] Fatal error: infinite loop including \"%s\"", g_recurslevel, filename)
g_numerrors = inf
return
end
@ -2200,11 +2200,11 @@ local Cinner = {
lotsofglass = cmd(D)
/ "_con._A_SpawnGlass(_aci,%1)",
mail = cmd(D)
/ "_con._spawnmany(_aci,4410,%1)", -- TODO: dyntile
/ "_con._spawnmany(_aci,'MAIL',%1)",
money = cmd(D)
/ "_con._spawnmany(_aci,1233,%1)", -- TODO: dyntile
/ "_con._spawnmany(_aci,'MONEY',%1)",
paper = cmd(D)
/ "_con._spawnmany(_aci,4460,%1)", -- TODO: dyntile
/ "_con._spawnmany(_aci,'PAPER',%1)",
sleeptime = cmd(D)
/ ACS".timetosleep=%1",

View file

@ -28,3 +28,9 @@ useractor 1 CYCLOIDHEAD 10
ifpdistl 1024 tip
state killme
enda
onevent EVENT_JUMP
mail 2
money 5
paper 3
endevent