Subversion Repositories eduke32

Rev

Rev 4962 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4962 Rev 4977
Line 1213... Line 1213...
1213
    end
1213
    end
1214
1214
1215
    g_data.level[EPMUL*vol+lev] = map
1215
    g_data.level[EPMUL*vol+lev] = map
1216
end
1216
end
1217
1217
-
 
1218
function Cmd.undefinelevel(vol, lev)
-
 
1219
    if (not (vol >= 0 and vol < conl.MAXVOLUMES)) then
-
 
1220
        errprintf("volume number exceeds maximum volume count.")
-
 
1221
        return
-
 
1222
    end
-
 
1223
-
 
1224
    if (not (lev >= 0 and lev < conl.MAXLEVELS)) then
-
 
1225
        errprintf("level number exceeds maximum number of levels per episode.")
-
 
1226
        return
-
 
1227
    end
-
 
1228
-
 
1229
    if (ffi) then
-
 
1230
        ffiC.C_UndefineLevel(vol, lev)
-
 
1231
    end
-
 
1232
end
-
 
1233
1218
local function defineXname(what, ffiCfuncname, X, name)
1234
local function defineXname(what, ffiCfuncname, X, name)
1219
    name = name:upper()
-
 
1220
    if (ffi) then
1235
    if (ffi) then
1221
        ffiC[ffiCfuncname](X, name)
1236
        ffiC[ffiCfuncname](X, name)
1222
        if (#name > 32) then
1237
        if (#name > 32) then
1223
            warnprintf("%s %d name truncated to 32 characters.", what, X)
1238
            warnprintf("%s %d name truncated to 32 characters.", what, X)
1224
        end
1239
        end
Line 1234... Line 1249...
1234
1249
1235
    name = defineXname("skill", "C_DefineSkillName", skillnum, name)
1250
    name = defineXname("skill", "C_DefineSkillName", skillnum, name)
1236
    g_data.skillname[skillnum] = name
1251
    g_data.skillname[skillnum] = name
1237
end
1252
end
1238
1253
-
 
1254
function Cmd.undefineskill(skillnum)
-
 
1255
    if (not (skillnum >= 0 and skillnum < conl.MAXSKILLS)) then
-
 
1256
        errprintf("skill number is negative or exceeds maximum skill count.")
-
 
1257
        return
-
 
1258
    end
-
 
1259
-
 
1260
    if (ffi) then
-
 
1261
        ffiC.C_UndefineSkill(skillnum)
-
 
1262
    end
-
 
1263
end
-
 
1264
1239
function Cmd.definevolumename(vol, name)
1265
function Cmd.definevolumename(vol, name)
1240
    if (not (vol >= 0 and vol < conl.MAXVOLUMES)) then
1266
    if (not (vol >= 0 and vol < conl.MAXVOLUMES)) then
1241
        errprintf("volume number is negative or exceeds maximum volume count.")
1267
        errprintf("volume number is negative or exceeds maximum volume count.")
1242
        return
1268
        return
1243
    end
1269
    end
1244
1270
1245
    name = defineXname("volume", "C_DefineVolumeName", vol, name)
1271
    name = defineXname("volume", "C_DefineVolumeName", vol, name)
1246
    g_data.volname[vol] = name
1272
    g_data.volname[vol] = name
1247
end
1273
end
1248
1274
-
 
1275
function Cmd.undefinevolume(vol)
-
 
1276
    if (not (vol >= 0 and vol < conl.MAXVOLUMES)) then
-
 
1277
        errprintf("volume number is negative or exceeds maximum volume count.")
-
 
1278
        return
-
 
1279
    end
-
 
1280
-
 
1281
    if (ffi) then
-
 
1282
        ffiC.C_UndefineVolume(vol)
-
 
1283
    end
-
 
1284
end
-
 
1285
1249
function Cmd.definegamefuncname(idx, name)
1286
function Cmd.definegamefuncname(idx, name)
1250
    local NUMGAMEFUNCTIONS = (ffi and ffiC.NUMGAMEFUNCTIONS or 56)
1287
    local NUMGAMEFUNCTIONS = (ffi and ffiC.NUMGAMEFUNCTIONS or 56)
1251
    if (not (idx >= 0 and idx < NUMGAMEFUNCTIONS)) then
1288
    if (not (idx >= 0 and idx < NUMGAMEFUNCTIONS)) then
1252
        errprintf("function number exceeds number of game functions.")
1289
        errprintf("function number exceeds number of game functions.")
1253
        return
1290
        return
Line 1859... Line 1896...
1859
1896
1860
    -- NOTE: gamevar.ogg and the like is OK, too
1897
    -- NOTE: gamevar.ogg and the like is OK, too
1861
    music = sp1 * tok.define * match_until(sp1 * tok.filename, sp1 * conl.keyword * sp1)
1898
    music = sp1 * tok.define * match_until(sp1 * tok.filename, sp1 * conl.keyword * sp1)
1862
        / Cmd.music,
1899
        / Cmd.music,
1863
1900
-
 
1901
    undefinelevel = cmd(D,D)
-
 
1902
        / Cmd.undefinelevel,
-
 
1903
    undefineskill = cmd(D)
-
 
1904
        / Cmd.undefineskill,
-
 
1905
    undefinevolume = cmd(D)
-
 
1906
        / Cmd.undefinevolume,
-
 
1907
1864
    --- 3. Game Settings
1908
    --- 3. Game Settings
1865
    -- gamestartup has 26/30 fixed defines, depending on 1.3D/1.5 version:
1909
    -- gamestartup has 26/30 fixed defines, depending on 1.3D/1.5 version:
1866
    gamestartup = (sp1 * tok.define)^26
1910
    gamestartup = (sp1 * tok.define)^26
1867
        / Cmd.gamestartup,
1911
        / Cmd.gamestartup,
1868
    spritenopal = cmd(D)
1912
    spritenopal = cmd(D)