/usr/share/games/instead/stead/gui.lua is in instead-data 1.9.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 | game.hinting = true;
game.showlast = true;
game.gui = {
fading = 4;
ways_delim = ' | ';
inv_delim = '\n';
hinv_delim = ' | ';
hideways = false;
hideinv = false;
}
iface.xref = function(self, str, obj, ...)
local o = stead.ref(obj);
local cmd=''
if not isObject(o) or isStatus(o) or (not o.id and not isXaction(o)) then
return str;
end
if stead.ref(ways():srch(obj)) then
cmd = 'go ';
elseif isMenu(o) then
cmd = 'act ';
elseif isSceneUse(o) then
cmd = 'use ';
elseif isXaction(o) and not o.id then
cmd = 'act ';
end
local a = ''
local i
local varg = {...}
for i = 1, stead.table.maxn(varg) do
a = a..','..varg[i]
end
if isXaction(o) and not o.id then
return stead.cat('<a:'..cmd..stead.deref(obj)..a..'>',str,'</a>');
end
return stead.cat('<a:'..cmd..'0'..tostring(o.id)..a..'>',str,'</a>');
end;
iface.anchor = function(self)
return '<a:#>'
end
iface.enum = function(self, n, str)
if str == nil or n == nil then return nil; end;
return n..self:nb(' - ')..str;
end
iface.title = function(self, str)
return nil
end;
iface.img = function(self, str)
if str == nil then return nil; end;
return "<g:"..str..">";
end;
iface.imgl = function(self, str)
if str == nil then return nil; end;
return "<g:"..str.."\\|left>";
end;
iface.imgr = function(self, str)
if str == nil then return nil; end;
return "<g:"..str.."\\|right>";
end;
iface.nb = function(self, str)
if type(str) ~= 'string' then return nil end
return "<w:"..str:gsub("\\", "\\\\\\"):gsub(">","\\>"):gsub("%^","\\^")..">";
end;
iface.under = function(self, str)
if str == nil then return nil; end;
return stead.cat('<u>',str,'</u>');
end;
iface.em = function(self, str)
if str == nil then return nil; end;
return stead.cat('<i>',str,'</i>');
end;
iface.st = function(self, str)
if str == nil then return nil; end;
return stead.cat('<s>',str,'</s>');
end;
iface.right = function(self, str)
if str == nil then return nil; end;
return stead.cat('<r>',str,'</r>');
end;
iface.left = function(self, str)
if str == nil then return nil; end;
return stead.cat('<l>',str,'</l>');
end;
iface.center = function(self, str)
if str == nil then return nil; end;
return stead.cat('<c>',str,'</c>');
end;
iface.just = function(self, str)
if str == nil then return nil; end;
return stead.cat('<j>',str,'</j>');
end;
iface.tab = function(self, str, al)
if tonumber(str) then
str = tostring(str)
end
if type(str) ~= 'string' then
return nil;
end
if al == 'right' then
str = str .. ",right"
elseif al == 'center' then
str = str .. ",center"
end
return '<x:'..str..'>'
end;
iface.bold = function(self, str)
if str == nil then return nil; end;
return stead.cat('<b>',str,'</b>');
end;
iface.top = function(self, str)
if str == nil then return nil; end;
return stead.cat('<t>',str,'</t>');
end;
iface.bottom = function(self, str)
if str == nil then return nil; end;
return stead.cat('<d>',str,'</d>');
end;
iface.middle = function(self, str)
if str == nil then return nil; end;
return stead.cat('<m>',str,'</m>');
end;
iface.inv = function(self, str)
return str
end;
iface.ways = function(self, str)
return str
end;
instead.get_inv = function(horiz)
local r = stead.call_value(game.gui, 'hideinv');
if r then
return
end
local str = iface:cmd("inv");
if str then
str = stead.string.gsub(str, '\n$','');
if not horiz then
str = stead.string.gsub(str, '\\?['.. stead.delim ..']',
{ [stead.delim] = game.gui.inv_delim, ['\\'..stead.delim] = stead.delim });
else
str = stead.string.gsub(str, '\\?['.. stead.delim ..']',
{ [stead.delim] = game.gui.hinv_delim, ['\\'..stead.delim] = stead.delim });
end
end
return str
end
instead.get_ways = function()
local r = stead.call_value(game.gui, 'hideways');
if r then
return
end
local str = iface:cmd("way");
if str and str ~= '' then
str = stead.string.gsub(str, '\n$','');
str = stead.string.gsub(str, '\\?['..stead.delim ..']',
{ [stead.delim] = game.gui.ways_delim, [ '\\'..stead.delim ] = stead.delim });
return iface:center(str);
end
return str
end
instead.get_title = function()
local s
if stead.api_version >= "1.2.0" then
s = stead.dispof(stead.here());
else
s = stead.call(stead.here(), 'nam');
end
if type(s) == 'string' and s ~= '' then
stead.state = false
s = "<c><b>"..stead.fmt(s).."</b></c>";
s = stead.string.gsub(s, '\\'..stead.delim, stead.delim);
end
return s
end
instead.finish_music = function()
if instead.get_music_loop() == 0 then
return false
end
local n = stead.get_music()
stead.set_music(n, -1);
return true
end
instead.isEnableSave = isEnableSave;
instead.isEnableAutosave = isEnableAutosave;
-- here is gui staff only
function stat(v)
v.status_type = true
return obj(v);
end
function isStatus(v)
if type(v) ~= 'table' then
return false
end
if v.status_type then
return true
end
return false
end
stead.menu_save = function(self, name, h, need)
local dsc;
if need then
print ("Warning: menu "..name.." can not be saved!");
return
end
stead.savemembers(h, self, name, need);
end
MENU_TAG_ID = 100000000
function menu(v)
v.menu_type = true
if v.inv == nil then
v.inv = function(s)
local r,v
r,v = stead.call(s, 'menu');
if v == nil then v = true end
if r == nil then
stead.obj_tag(stead.me(), MENU_TAG_ID); -- retag menu field
end
return r, v
end
end
if v.act == nil then
v.act = function(s)
local r,v
r,v = stead.call(s, 'menu');
if v == nil then v = true end
if r == nil then
stead.obj_tag(stead.me(), MENU_TAG_ID); -- retag menu field
end
return r, v
end
end
if v.save == nil then
v.save = stead.menu_save;
end
return obj(v);
end
function isMenu(v)
if type(v) ~= 'table' then
return false
end
if v.menu_type then
return true
end
return false
end
stead.fmt = function(...)
local i, res
local a={...}
for i=1,stead.table.maxn(a) do
if type(a[i]) == 'string' then
local s = stead.string.gsub(a[i],'\t', stead.space_delim):gsub('[\n]+', stead.space_delim);
s = stead.string.gsub(s, '\\?[\\^]', { ['^'] = '\n', ['\\^'] = '^',
['\\\\'] = '\\' });
res = stead.par('', res, s);
end
end
return res
end
game.fading = function(s)
local rc = false
local p = stead.call(stead.here(), 'pic');
if stead.cmd == 'load' then
game.lastpic = p;
return true
end
if not stead.state then --only for states!!!
return false
end
if game._time == 1 then -- first cmd
game.lastpic = p;
return true
end
if PLAYER_MOVED or game.lastpic ~= p then
rc = true
end
game.lastpic = p
return rc
end
game.gui.is_fading = function() --to check fading from sdl gui
local r,g,v
local h = stead.here()
if not isRoom(h) then
return false
end
r,v = stead.call_value(h, 'fading');
if r then
if tonumber(r) and v == nil then
return true, tonumber(r)
end
return r, v
end
g,v = stead.call_value(game, 'fading');
if tonumber(g) and v == nil then
return true, tonumber(g)
end
return g, v
end
instead.get_fading = function()
local r, v
r, v = stead.call_value(game.gui, 'is_fading')
if v == nil and r then v = game.gui.fading end
return r,v
end
-- vim:ts=4
|