mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-24 10:40:46 +00:00
LunaCON: implement 'definegametype', allow writing userdef.level_number.
Also, allow (implicit) actor index -1 to 'sound' like in C-CON and fix MULTIMODE gamevar definition (was 0, not 1). git-svn-id: https://svn.eduke32.com/eduke32@3826 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
593b82692e
commit
640eda2194
5 changed files with 46 additions and 14 deletions
|
@ -99,13 +99,14 @@ static struct { uint32_t keyw; uint32_t date; } g_keywdate[] =
|
|||
#endif
|
||||
|
||||
char g_szScriptFileName[BMAX_PATH] = "(none)"; // file we're currently compiling
|
||||
static char g_szCurrentBlockName[256] = "(none)", g_szLastBlockName[256] = "NULL";
|
||||
|
||||
int32_t g_totalLines,g_lineNumber;
|
||||
static int32_t g_checkingIfElse, g_processingState, g_lastKeyword = -1;
|
||||
char g_szBuf[1024];
|
||||
|
||||
#if !defined LUNATIC
|
||||
static char g_szCurrentBlockName[256] = "(none)", g_szLastBlockName[256] = "NULL";
|
||||
static int32_t g_checkingIfElse, g_processingState, g_lastKeyword = -1;
|
||||
|
||||
// The pointer to the start of the case table in a switch statement.
|
||||
// First entry is 'default' code.
|
||||
static intptr_t *g_caseScriptPtr=NULL;
|
||||
|
@ -163,16 +164,18 @@ int32_t g_iPlayerVarID=-1;
|
|||
int32_t g_iActorVarID=-1;
|
||||
|
||||
intptr_t *apScriptGameEvent[MAXGAMEEVENTS];
|
||||
static intptr_t *g_parsingEventPtr=NULL;
|
||||
|
||||
#if !defined LUNATIC
|
||||
static intptr_t *g_parsingEventPtr=NULL;
|
||||
|
||||
gamevar_t aGameVars[MAXGAMEVARS];
|
||||
gamearray_t aGameArrays[MAXGAMEARRAYS];
|
||||
int32_t g_gameVarCount=0;
|
||||
int32_t g_gameArrayCount=0;
|
||||
#endif
|
||||
|
||||
static char *textptr;
|
||||
#endif
|
||||
|
||||
int32_t g_numCompilerErrors,g_numCompilerWarnings;
|
||||
|
||||
extern int32_t g_maxSoundPos;
|
||||
|
@ -2235,13 +2238,22 @@ void C_DefineLevelName(int32_t vol, int32_t lev, const char *fn,
|
|||
|
||||
void C_DefineGameFuncName(int32_t idx, const char *name)
|
||||
{
|
||||
assert(idx < NUMGAMEFUNCTIONS);
|
||||
assert((unsigned)idx < NUMGAMEFUNCTIONS);
|
||||
|
||||
Bstrncpyz(gamefunctions[idx], name, MAXGAMEFUNCLEN);
|
||||
Bstrncpyz(keydefaults[3*idx], name, MAXGAMEFUNCLEN);
|
||||
|
||||
hash_add(&h_gamefuncs, gamefunctions[idx], idx, 0);
|
||||
}
|
||||
|
||||
void C_DefineGameType(int32_t idx, int32_t flags, const char *name)
|
||||
{
|
||||
Bassert((unsigned)idx < MAXGAMETYPES);
|
||||
|
||||
GametypeFlags[idx] = flags;
|
||||
Bstrncpyz(GametypeNames[idx], name, sizeof(GametypeNames[idx]));
|
||||
g_numGametypes = idx+1;
|
||||
}
|
||||
#endif
|
||||
|
||||
LUNATIC_EXTERN int32_t C_SetDefName(const char *name)
|
||||
|
|
|
@ -13,6 +13,7 @@ module(...)
|
|||
|
||||
MAXVOLUMES = 7
|
||||
MAXLEVELS = 64
|
||||
MAXGAMETYPES = 16
|
||||
|
||||
MAXSKILLS = 7
|
||||
|
||||
|
@ -840,7 +841,7 @@ local UserdefLabels = {
|
|||
fta_on = UD".fta_on",
|
||||
god = UDRO".god",
|
||||
idplayers = UDRO".idplayers",
|
||||
level_number = UDRO".level_number",
|
||||
level_number = { UD".level_number", UD":set_level_number(%%s)" },
|
||||
lockout = UDRO".lockout",
|
||||
pause_on = UDRO".pause_on",
|
||||
player_skill = UD".player_skill",
|
||||
|
|
|
@ -1588,7 +1588,9 @@ local function S_StopSound(sndidx)
|
|||
end
|
||||
|
||||
function _soundplaying(aci, sndidx)
|
||||
check_sprite_idx(aci)
|
||||
if (aci ~= -1) then
|
||||
check_sprite_idx(aci)
|
||||
end
|
||||
check_sound_idx(sndidx)
|
||||
return (ffiC.S_CheckSoundPlaying(aci, sndidx) ~= 0)
|
||||
end
|
||||
|
@ -1662,7 +1664,8 @@ function _setaspect(viewingrange, yxaspect)
|
|||
end
|
||||
|
||||
function _setgamepalette(pli, basepal)
|
||||
ffiC.P_SetGamePalette(player[pli], basepal, 2+16)
|
||||
check_player_idx(pli)
|
||||
ffiC.P_SetGamePalette(ffiC.g_player_ps[pli], basepal, 2+16)
|
||||
end
|
||||
|
||||
-- Map state persistence.
|
||||
|
|
|
@ -670,6 +670,7 @@ void C_DefineLevelName(int32_t vol, int32_t lev, const char *fn,
|
|||
const char *levelname);
|
||||
void C_DefineProjectile(int32_t j, int32_t what, int32_t val);
|
||||
void C_DefineGameFuncName(int32_t idx, const char *name);
|
||||
void C_DefineGameType(int32_t idx, int32_t flags, const char *name);
|
||||
int32_t C_SetDefName(const char *name);
|
||||
|
||||
int32_t SCRIPT_GetNumber(int32_t scripthandle, const char *sectionname, const char *entryname, int32_t *number);
|
||||
|
@ -792,6 +793,7 @@ function actor_static_members.delete(i)
|
|||
error("Attempt to delete sprite in EVENT_EGS", 2)
|
||||
end
|
||||
|
||||
-- TODO_MP
|
||||
if (ffiC.g_player_ps[0].i == i) then
|
||||
error("Attempt to delete player 0's APLAYER sprite", 2)
|
||||
end
|
||||
|
@ -1173,12 +1175,15 @@ local user_defs_mt = {
|
|||
end,
|
||||
|
||||
set_volume_number = function(ud, volume_number)
|
||||
-- XXX: should volume_number==MAXVOLUMES be allowed too?
|
||||
if (volume_number >= con_lang.MAXVOLUMES+0ULL) then
|
||||
error("invalid volume number "..volume_number, 2)
|
||||
end
|
||||
-- NOTE: volume_number==MAXVOLUMES disallowed.
|
||||
bcheck.volume_idx(volume_number)
|
||||
ud.volume_number = volume_number
|
||||
end,
|
||||
|
||||
set_level_number = function(ud, level_number)
|
||||
bcheck.level_idx(level_number)
|
||||
ud.level_number = level_number
|
||||
end,
|
||||
},
|
||||
}
|
||||
ffi.metatype("user_defs", user_defs_mt)
|
||||
|
|
|
@ -580,7 +580,7 @@ local function reset_labels()
|
|||
CLIPMASK1 = (256*65536)+64, -- hittable
|
||||
-- TODO_MP
|
||||
COOP = 0,
|
||||
MULTIMODE = 0,
|
||||
MULTIMODE = 1,
|
||||
numplayers = 1,
|
||||
myconnectindex = 0,
|
||||
}
|
||||
|
@ -953,6 +953,17 @@ function Cmd.definegamefuncname(idx, name)
|
|||
end
|
||||
end
|
||||
|
||||
function Cmd.definegametype(idx, flags, name)
|
||||
if (not (idx >= 0 and idx < conl.MAXGAMETYPES)) then
|
||||
errprintf("gametype number exceeds maximum gametype count.")
|
||||
return
|
||||
end
|
||||
|
||||
if (ffi) then
|
||||
ffiC.C_DefineGameType(idx, flags, name)
|
||||
end
|
||||
end
|
||||
|
||||
-- strip whitespace from front and back
|
||||
local function stripws(str)
|
||||
return str:match("^%s*(.*)%s*$")
|
||||
|
@ -1382,7 +1393,7 @@ local Couter = {
|
|||
definegamefuncname = sp1 * tok.define * newline_term_string -- XXX: TS?
|
||||
/ Cmd.definegamefuncname,
|
||||
definegametype = n_defines(2) * newline_term_string
|
||||
/ Cmd.NYI("`definegametype'"), -- TODO_MP
|
||||
/ Cmd.definegametype,
|
||||
definelevelname = n_defines(2) * sp1 * tok.filename * sp1 * tok.time * sp1 * tok.time *
|
||||
newline_term_string
|
||||
/ Cmd.definelevelname,
|
||||
|
|
Loading…
Reference in a new issue