loadfont("BrogueFont5", 16, 16, fontBrogue) dofile(commondir.."generic-tile.noe") mapregion = {x0=21, y0=3, x1=100, y1=5} minipos = {x=1, y=0.95} conssize = {x=100, y=34} lprepareconsole = prepareconsole function prepareconsole() mapregion = {x0=21, y0=3, x1=conssize.x, y1=conssize.y-2} lprepareconsole() MAP2 = renewscreen(MAP2, mapsize.x, mapsize.y) end function settilectr() tilectr = {x=scrsize.x*3/5, y=scrsize.y/2} end --addtomenu(mainmenu, ".", writechoice("switch BRogue font"), -- function() -- switchfont() -- end -- ) do local oldxtileaux = xtileaux function deunic(av) if av == 183 then av = 250 -- "." -- floor elseif av == 128+1 then av = avf(":") -- chasm elseif av == 128+2 then av = 127 elseif av == 128+3 then av = avf("^") elseif av == 128+4 then av = avf("&") -- foliage elseif av == 128+5 then av = 12 -- "," -- amu elseif av == 128+6 then av = 13 -- "?" -- scroll elseif av == 128+7 then av = 9 -- "=" -- ring elseif av == 128+8 then av = 24 -- "(" -- weapon elseif av == 128+9 then av = 11 -- "0" -- gem/turret elseif av == 128+10 then av = avf(":") -- missing elseif av == 128+11 then av = avf("+") elseif av == 128+12 then av = avf("$") end return av end -- brogue still uses old ugly functions... function xtileaux(ch, co, av, ba) local uu = global_uu local function recco(x) return tilerecolor(x, co) end local function recba(x) return tilerecolor(x, ba) end local function rgf(x) return fget(Fonts["BrogueFont5"].font, x) end local function floorroof(fco, rco) return tilemerge( tilespatial(tilerecolor(WT[10][uu], fco), spFlat + spFloor + spIFloor), tilespatial(tilerecolor(WT[4][uu], rco), spCeil) ) end local function floorcol(fco) return floorroof(fco, fco) end local function lavacol(fba, fco) return tilemerge( tilespatial(tilerecolor(WT[4][uu], fba), spFlat + spFloor + spIFloor), tilespatial(tilerecolor(WT[4][uu], colormix(fco, 0)), spCeil) ) end if av < 0 or co == ba or av == 32 then return tilefill(0) elseif ch == "#" then return tilespatial(recba(WT[6][uu]), spFlat + spWall + spIWall + spICeil) elseif av == 128+9 then av = 11 -- "0" -- gem/turret return tilemerge(tilespatial(recba(WT[6][uu]), spFlat + spWall + spIWall + spICeil), tilespatial(recco(rgf(ch)), spFlat + spWall + spIWall + spICeil)) elseif av == 183 then return tilemerge(floorcol(ba), tilespatial(recco(rgf(ch)), spFlat + spFloor + spIFloor)) elseif ch == "+" then return tilespatial(tilemerge(recba(WT[6][uu]), recco(rgf(ch))), spFlat + spWall + spIWall + spICeil) elseif ch == "=" then return tilemerge(floorcol(ba), tilespatial(recco(rgf(ch)), spFlat + spFloor + spIFloor)) elseif ch == "\"" or av == 128+4 or av == 128+3 or av == 128+5 or av == 128+11 or av == 128+12 or av == 128+6 or av == 128+7 or av == 128+8 then return tilemerge(floorcol(ba), tilespatial(recco(rgf(ch)), spFlat + spMonst + spIItem)) elseif av == 128+1 or av == 128+2 then return tilemerge(floorroof(ba,co), tilespatial(recco(rgf(ch)), spFlat + spFloor + spIFloor)) elseif (av >= 64 and av <= 90) or (av >= 97 and av <= 122) then return tilemerge(floorcol(ba), tilespatial(recco(rgf(ch)), spFlat + spMonst + spIItem)) elseif ch == "~" then return lavacol(ba, co) else return tilemerge(floorcol(ba), tilespatial(recco(rgf(ch)), spFlat + spMonst + spIItem)) end end end function xminimap(C) b = 0 local ch = gch(C) local av = av(ch) if ispc(C) then b = 0xFFFFFF elseif ch == (">") or ch == ("<") then b = 0xFF00FF else b = gba(C) end return tilefill(b) end function stripfont(x) local av,co,ba = gavcoba(x) av = deunic(av) local ret = tileavcobaf(av, co, ba, Font) return ret end IMGswitch = renewscreen(IMGswitch, conssize.x, conssize.y) do local ldrawdisplay = drawdisplay function drawdisplay() if not string.match(curfont, "Brogue") then profstart("fontswitch") scrcopy(IMG, 0, 0, IMGswitch, 0,0, conssize.x, conssize.y, stripfont) profend("fontswitch") IMGorig = IMG IMG = IMGswitch ldrawdisplay() IMG = IMGorig else ldrawdisplay() end end end function addbb(x) return tilemerge( tilefill(0x404040), x) end function sendmouse(ev) -- handle the buttons local ex = ev.x / fontsize.x local ey = ev.y / fontsize.y if not itemcnt then itemcnt = 0 end if not invst then invst = 0 end if not ylast then ylast = 0 end if (ey > 33) or (ex > invst+18 and ey >= 3 and ey < 3 + itemcnt) or (ex > 17 and ex < 58 and ey > 2 and ey < ylast) then ev.x = ex ev.y = ey else pixeltoproc(ev) end netsendmouse(ev) end function isinv(tile) local ch = gch(tile) return gco(tile) > 0 and (ch == ")" or ch == "}") end function nonemp(tile) return gchv(tile) ~= 32 and gba(tile) ~= gco(tile) end lcopymap = copymap function copymap() lcopymap() itemcnt = 0 if mapon and mode ~= modeASCII then invst = 40 while invst > 20 and not isinv(scrget(MAP, invst, itemcnt)) do invst = invst - 1 end while isinv(scrget(MAP, invst, itemcnt)) do itemcnt = itemcnt + 1 end if itemcnt > 0 then mapon = false scrcopy(MAP, invst-2, 0, IMG, invst-2+mapregion.x0, mapregion.y0, mapsize.x-invst+2, itemcnt+3, eq) else scrcopy(MAP, 0, 0, MAP2, 0, 0, mapsize.x, mapsize.y, eq) end local cg = scrget(IMG, 17, 5) if gchv(cg) > 32 and gco(cg) ~= gba(cg) then ylast = 7 while (ylast < conssize.y) and (nonemp(scrget(IMG, 17, ylast)) or nonemp(scrget(IMG, 17, ylast-1))) do ylast = ylast+1 end ylast = ylast + 2 scrcopy(MAP, 0, 0, IMG, mapregion.x0, mapregion.y0, 38, ylast-3, eq) else ylast = 0 end if not mapon then scrcopy(MAP2, 0, 0, MAP, 0, 0, mapsize.x, mapsize.y, eq) end end end msgbox = {x0=21, x1=100, y0=0,y1=3} dofile(commondir.."hydra-ogg.noe") loadsounds() function gotgmessage(s) function mac(pat, snd, vol) if string.match(s, pat) and snd and snd > 0 then playsound(snd, vol) return true end return false end lost= mac("rough stone", SndPickup, 50) or mac("now have", SndPickup, 50) or mac("pack is too full", SndSmash4, 50) or mac("launches a sticky", SndChaos, 50) or mac("splits in two", SndSilver, 50) or mac("begin to hallucinate", SndChaos, 50) or mac("scalding poison fills", SndPoison, 50) or mac("trembles and time freezes", SndPoison, 50) or mac("is frozen in place", SndIce, 50) or mac("emits a flash of light", SndGold, 50) or mac("slows down", SndPoison, 50) or mac("confused", SndPoison, 50) or mac("pieces of gold", SndGold, 50) or mac("paralyzed", SndPoison, 50) or mac("pulses, and the damage is shared", SndPoison, 50) or mac("hear something get destroyed", SndDeath, 50) or mac("now familiar enough", SndTada, 50) or mac("feel a sense of loss", SndDeath, 50) or mac("casts a ", SndMystery, 50) or mac("fire", SndFire, 50) or mac("flame", SndFire, 50) or mac("pressure plate", SndPickup, 50) or mac("stuck fast", SndChaos, 50) or mac("stench of rot", SndBone, 50) or mac("lichen's grasping", SndPoison, 50) or mac("profusely", SndBone, 50) or mac("faithful ally", SndTada, 50) or mac("bound to your will", SndTada, 50) or mac("struggle", SndChaos, 50) or mac("seizes", SndChaos, 50) or mac("holding your legs", SndChaos, 50) or mac("deflect", SndMystery, 50) or mac("flask shatters", SndSplash, 50) or mac("cleansing light", SndMystery, 50) or mac("surge of energy", SndMystery, 50) or mac("protective golden", SndMystery, 50) or mac("piercing shriek", SndMystery, 50) or mac("fabric of space", SndMystery, 50) or mac("brilliant flash", SndMystery, 50) or mac("numbing torrent", SndMystery, 50) or mac("has a map", SndMystery, 50) or mac("turquoise light", SndMystery, 50) or mac("newfound strength", SndTada, 50) or mac("weakens", SndSplash, 50) or mac("the fallen", SndTada, 50) or mac("stole", SndWoof, 50) or mac("floats away", SndSplash, 50) or mac("tasted delicious", SndDrink, 50) or mac("yummy mango", SndDrink, 50) or mac("come to level", SndTada, 50) or mac("to be cursed", SndMystery, 50) or mac("are hungry", SndWoof, 50) or mac("with hunger", SndWoof, 50) or mac("appears", SndMystery, 50) or mac("combat in the distance", SndSmash3, 50) or mac("die", SndDeath, 50) or mac("death", SndDeath, 50) or mac("hit", SndSmash3, 50) or mac("miss", SndSmash4, 50) or mac("defeated", SndDeath, 50) or mac("dispatch", SndDeath, 50) end setwindowtitle("Brogue") defaultmode(1) rungame("whatever")