Quote
Ok, but if I want clear all tiles in EVENT_DISPLAYWEAPON, what can I do for this?
gameevent{ "DISPLAYWEAPON", function() gv.g_RETURN = -1 end }
This code works fine for this
Have a lunacon operate like this: setactorvar[spriteid].variable?
Quote
gameevent{ "DISPLAYWEAPON", function() gv.g_RETURN = -1 end }
M210, on 22 August 2013 - 08:40 PM, said:
gameevent{ "DISPLAYWEAPON", function() gv.g_RETURN = -1 end }
Quote
Helixhorned, on 23 August 2013 - 09:50 AM, said:
module(...) local se_xvel = con.actorvar(0) local se_yvel = con.actorvar(0) local se_zvel = con.actorvar(0) local se_lotag = con.actorvar(0) local se_hitag = con.actorvar(0) local se_pal = con.actorvar(0) local spr_sync = con.actorvar(0) local sectordist = con.actorvar(0) local sectorspeed = con.actorvar(0) require("end_gamevars")
if(bit.band(sprite[i].cstat, 256) ~= 0) then sprite[i].cstat = bit.bxor(sprite[i].cstat, 256) end
This post has been edited by M210: 24 August 2013 - 04:54 AM
This post has been edited by M210: 24 August 2013 - 06:58 AM
M210, on 23 August 2013 - 01:18 PM, said:
module(...) local se_xvel = con.actorvar(0) [...] require("end_gamevars")
Quote
Quote
M210, on 24 August 2013 - 04:49 AM, said:
if(bit.band(sprite[i].cstat, 256) ~= 0) then sprite[i].cstat = bit.bxor(sprite[i].cstat, 256) end
sprite[i].cstatbits:clear(256)
Quote
// this is the part of my sectoreffector code in EVENT_LOADACTOR ifvare lotag 64 // slider/rotator SE { setvar spriteid 0 setvar rot_varmax 0 whilevarvarn spriteid NUMACTORS // THIS IS A ANSWER TO OTHER YOUR QUESTION - NUMSPRITES NEED TO ME FOR REDUCTION OF THE CYCLES { getactor[spriteid].picnum picnum ifvare picnum GPSPEED { getactor[THISACTOR].xvel rx_can // if xvel of GPSPEED equal xvel of SE (address) then get lotag and hitag of //GPSPEED and set these variables as sector speed and sector distance getactor[spriteid].xvel tx_can ifvarvare rx_can tx_can { getactor[spriteid].lotag lotag getactor[spriteid].hitag hitag ifvare lotag 0 setvar sectordist 256 else setvarvar sectordist lotag ifvare hitag 0 setvar sectorspeed 16 else setvarvar sectorspeed hitag } //BTW GPSPEED is killing after load actors, therefore I cant using "headspritesect spriteid sectorid" -- "nextspritesect spriteid spriteid" cycles } else ifvare picnum MUSICANDSFX // if addresses is found, get lotag's and hitag's of MUSICANDSFX and set these to sounds for sector moving { getactor[spriteid].xvel rx_can getactor[THISACTOR].xvel tx_can getactor[spriteid].zvel zvel ifvarvare tx_can rx_can { ifvare zvel 0 { getactor[spriteid].lotag lotag setvarvar doorsound_open lotag getactor[spriteid].hitag hitag setvarvar doorsound_close hitag } ifvare zvel 1 { setvar se64_msf 1 getactor[spriteid].lotag lotag setvarvar doorsound_open2 lotag getactor[spriteid].hitag hitag setvarvar doorsound_close2 hitag } } } [ ... ], etc..
Quote
This post has been edited by M210: 24 August 2013 - 08:11 AM
sprite[i].cstatbits:clear(256)works as my
if(bit.band(sprite[i].cstat, 256) ~= 0) then sprite[i].cstat = bit.bxor(sprite[i].cstat, 256) end
M210, on 24 August 2013 - 07:30 AM, said:
Quote
Quote
whilevarvarn spriteid NUMACTORS // THIS IS A ANSWER TO OTHER YOUR QUESTION - NUMSPRITES NEED TO ME FOR REDUCTION OF THE CYCLES
Quote
//BTW GPSPEED is killing after load actors, therefore I cant using "headspritesect spriteid sectorid" -- "nextspritesect spriteid spriteid" cycles
M210, on 24 August 2013 - 07:47 AM, said:
sprite[i].cstatbits:clear(256)works as my
if(bit.band(sprite[i].cstat, 256) ~= 0) then sprite[i].cstat = bit.bxor(sprite[i].cstat, 256) end
Quote
Quote
//from EVENT_LOADACTOR ifvare NUMACTORS 0 setvarvar NUMACTORS Numsprites //set NUMACTOR == Numsprites, because Numsprite may decrease after deleting sprites like GPSPEED, // and whilevarn can't find such GPSPEED's ifvarvarg Numsprites NUMACTORS setvarvar NUMACTORS Numsprites //NUMACTOR correction //from EVENT_SPAWN ifvarvarg THISACTOR NUMACTORS setvarvar NUMACTORS THISACTOR //during level loading there are added and removed sprites, therefore numactors need correct too.
Quote
M210, on 24 August 2013 - 11:36 AM, said:
Quote
Quote
Quote
Quote
local dx = wall[se_wallptr].x - spr.x local dy = wall[se_wallptr].y - spr.y local se_ang = math.atan2 (dx, dy) --getangle se_ang = se_ang * (180/math.pi) - 90 se_ang = 2048 * se_ang / 360 if(se_ang < 0) then se_ang = se_ang + 1024 end print(se_ang)
M210, on 25 August 2013 - 09:00 AM, said:
local A2B = 1024/math.pi local function ourgetang(x, y) local ang = A2B*math.atan2(y, x) -- note the swapped args return bit.band(math.floor(ang), 2047) end
---------- getangle test 10, 100: getangle: 480, math.atan2: 479 10,-100: getangle:1569, math.atan2:1568 -10,-100: getangle:1504, math.atan2:1503 -10, 100: getangle: 545, math.atan2: 544 0, 0: getangle: 0, math.atan2: 0 Time for 100000 runs: getangle: 2.289 ms, math.atan2: 0.156 ms ----------
local function ourgetang(x, y) local ang = (1024/math.pi)*math.atan2(y, x) -- note the swapped args return bit.band(math.ceil(ang), 2047) end
---------- getangle test x, y: getangle(x, y) | math.atan2/ceil | math.atan2/floor 10, 100: 480, 480, 479 10,-100: 1569, 1569, 1568 -10,-100: 1504, 1504, 1503 -10, 100: 545, 545, 544 0, 0: 0, 0, 0 1, 0: 0, 0, 0 0, 1: 512, 512, 512 -1, 0: 1024, 1024, 1024 0, -1: 1536, 1536, 1536 Time for 100000 runs: getangle: 2.219 ms, math.atan2: 4.924 ms
TerminX, on 30 August 2013 - 02:14 PM, said:
This post has been edited by M210: 31 August 2013 - 11:52 AM
TerminX, on 30 August 2013 - 02:14 PM, said:
Quote
Quote
Helixhorned, on 02 September 2013 - 06:42 AM, said:
M210, on 31 August 2013 - 11:30 AM, said:
gameevent{ "JUMP", function() for i in spritesofstat(actor.STAT.EFFECTOR) do -- NOTE: don't code these loops by hand if (sprite[i].xvel == 10) then active[i] = 1 -- should be a boolean instead, see below end end end }
if (moving_var[i] == 0) then moving_var[i] = 1 else moving_var[i] = 0 end
moving_var[i] = not moving_var[i]
-- сохранение геометрии движущихся секторов -- (Saving of moving sector geometry) for s=0,gv.numsectors-1 do local sec = sector[s] if (spr.hitag == sec.hitag) then for w in wallsofsect(s) do -- NOTE: There's no arithmetic defined between wall[] -- and sprite[] objects defined, but we can make a -- 'xmath.ivec3' out of the latter. That one will -- operate with the left-hand side. local dvec = wall[w] - spr^0 -- The above could also e.g. be --local dvec = wall[w] - xmath.vec3(spr) -- (or ivec3, doesn't matter that much here.) -- NOTE: These two should be gamevars, too. LOADACTOR -- events are NOT run on savegame restoration! SE_PNDIST[w] = dvec:len2() -- distance SE_PNANG[w] = gv.getangle(dvec.x, dvec.y) -- angle end end end
se_moving[i] = 1 active[i] = 0 -- I'd find it prettier... else active[i] = 0 -- ...to move these... end -- ... here.
local se_spr = sprite[j] if(se_spr.picnum ~= NAME.SECTOREFFECTOR) then if(spr.owner > 0 and spr.owner == se_spr.owner and spr ~= se_spr) then
Quote
-- <spritenum>: the sprite number of the newly spawned object, or nil spritenum = con.shoot(parentspritenum, tilenum [, addtoqueue])
Quote
Quote
Quote
Quote
getplayer[THISACTOR].horiz MY_ZDIST subvar MY_ZDIST 100 mulvar MY_ZDIST -2048
Quote
This post has been edited by M210: 09 September 2013 - 09:29 AM
if(spr.picnum == 4362) then local pid = player[pi].i local pspr = sprite[pid] local aimv = 256*xmath.bangvec(pspr.ang) local zvel = ( player[pi].horiz - 100 ) * (-2048) local hit = hitscan(pspr, pspr.sectnum, aimv.x, aimv.y, zvel, gv.CLIPMASK1) print(hit.pos.x) print(hit.pos.y) sprite.changestat(i, 1) spr.x = hit.pos.x spr.y = hit.pos.y spr.z = hit.pos.z end
getplayer[THISACTOR].horiz MY_ZDIST subvar MY_ZDIST 100 mulvar MY_ZDIST -2048
M210, on 09 September 2013 - 09:26 AM, said:
local ps = player[pli] local ray = xmath.kangvec(ps.ang, -(ps.horiz-100)*2048) local hit = hitscan(ps.pos, ps.cursectnum, ray, 0) if (hit.sector >= 0) then sprite[chair]:setpos(hit.pos) -- "chair" is the index of the crosshair sprite sprite.changesect(chair, hit.sector) end
Helixhorned, on 22 September 2013 - 04:44 AM, said:
James, on 26 December 2013 - 12:50 PM, said: