mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-16 09:21:36 +00:00
Lunatic: cmdline switch to run test script, compile out more code, 2 more GVs.
git-svn-id: https://svn.eduke32.com/eduke32@3415 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
b6ca618694
commit
142e36d6f4
14 changed files with 78 additions and 59 deletions
|
@ -153,7 +153,7 @@ void G_OpenDemoWrite(void)
|
|||
ud.recstat = ud.m_recstat = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
#if !defined LUNATIC
|
||||
if (demorec_diffs_cvar && !demorec_force_cvar)
|
||||
for (i=1; i<g_scriptSize-2; i++)
|
||||
{
|
||||
|
@ -172,7 +172,7 @@ void G_OpenDemoWrite(void)
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
do
|
||||
{
|
||||
if (demonum == MAXDEMOS)
|
||||
|
|
|
@ -138,11 +138,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
static inline int32_t G_HaveEvent(int32_t iEventID)
|
||||
{
|
||||
return
|
||||
#ifdef LUNATIC
|
||||
El_HaveEvent(iEventID) ||
|
||||
return El_HaveEvent(iEventID);
|
||||
#else
|
||||
return apScriptGameEvent[iEventID]!=NULL;
|
||||
#endif
|
||||
apScriptGameEvent[iEventID]!=NULL;
|
||||
}
|
||||
|
||||
static inline int32_t G_HaveActor(int32_t actortile)
|
||||
|
|
|
@ -8945,6 +8945,15 @@ static void G_CheckCommandLine(int32_t argc, const char **argv)
|
|||
i++;
|
||||
continue;
|
||||
}
|
||||
#ifdef LUNATIC
|
||||
if (!Bstrcasecmp(c+1,"testlua"))
|
||||
{
|
||||
extern int32_t g_testLua;
|
||||
g_testLua = 1;
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
#if !defined(_WIN32)
|
||||
if (!Bstrcasecmp(c+1,"usecwd"))
|
||||
{
|
||||
|
|
|
@ -40,6 +40,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
int32_t g_scriptVersion = 13; // 13 = 1.3D-style CON files, 14 = 1.4/1.5 style CON files
|
||||
uint32_t g_scriptDateVersion = 99999999; // YYYYMMDD
|
||||
#if !defined LUNATIC
|
||||
static uint32_t g_scriptLastKeyword; // = NUMKEYWORDS-1;
|
||||
|
||||
#define NUMKEYWDATES (int32_t)(sizeof(g_keywdate)/sizeof(g_keywdate[0]))
|
||||
|
@ -90,6 +91,7 @@ static struct { uint32_t keyw; uint32_t date; } g_keywdate[] =
|
|||
{ CON_ECHO, 20120304 },
|
||||
{ CON_SHOWVIEWUNBIASED, 20120331 },
|
||||
};
|
||||
#endif
|
||||
|
||||
char g_szScriptFileName[BMAX_PATH] = "(none)"; // file we're currently compiling
|
||||
static char g_szCurrentBlockName[256] = "(none)", g_szLastBlockName[256] = "NULL";
|
||||
|
@ -158,10 +160,12 @@ int32_t g_iActorVarID=-1;
|
|||
intptr_t *apScriptGameEvent[MAXGAMEEVENTS];
|
||||
static intptr_t *g_parsingEventPtr=NULL;
|
||||
|
||||
#if !defined LUNATIC
|
||||
gamevar_t aGameVars[MAXGAMEVARS];
|
||||
gamearray_t aGameArrays[MAXGAMEARRAYS];
|
||||
int32_t g_gameVarCount=0;
|
||||
int32_t g_gameArrayCount=0;
|
||||
#endif
|
||||
|
||||
static char *textptr;
|
||||
int32_t g_numCompilerErrors,g_numCompilerWarnings;
|
||||
|
@ -1145,11 +1149,11 @@ const memberlabel_t InputLabels[]=
|
|||
char *bitptr; // pointer to bitmap of which bytecode positions contain pointers
|
||||
#define BITPTR_POINTER 1
|
||||
|
||||
#if !defined LUNATIC
|
||||
hashtable_t h_gamevars = { MAXGAMEVARS>>1, NULL };
|
||||
hashtable_t h_arrays = { MAXGAMEARRAYS>>1, NULL };
|
||||
hashtable_t h_labels = { 11264>>1, NULL };
|
||||
|
||||
#if !defined LUNATIC
|
||||
static hashtable_t h_keywords = { CON_END>>1, NULL };
|
||||
|
||||
static hashtable_t sectorH = { SECTOR_END>>1, NULL };
|
||||
|
@ -6288,11 +6292,9 @@ void C_Compile(const char *filenam)
|
|||
C_InitQuotes();
|
||||
}
|
||||
}
|
||||
#endif // !defined LUNATIC
|
||||
|
||||
void C_ReportError(int32_t iError)
|
||||
{
|
||||
#if !defined LUNATIC
|
||||
if (Bstrcmp(g_szCurrentBlockName,g_szLastBlockName))
|
||||
{
|
||||
if (g_parsingEventPtr || g_processingState || g_parsingActorPtr)
|
||||
|
@ -6381,5 +6383,5 @@ void C_ReportError(int32_t iError)
|
|||
initprintf("%s:%d: warning: symbol `%s' already used for game variable.\n",g_szScriptFileName,g_lineNumber,label+(g_numLabels<<6));
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -33,13 +33,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#define MAXCHEATLEN 20
|
||||
#define NUMCHEATCODES (int32_t)(sizeof(CheatStrings)/sizeof(CheatStrings[0]))
|
||||
|
||||
extern hashtable_t h_gamefuncs;
|
||||
|
||||
#if !defined LUNATIC
|
||||
extern hashtable_t h_gamevars;
|
||||
extern hashtable_t h_arrays;
|
||||
//extern hashtable_t h_keywords;
|
||||
extern hashtable_t h_gamefuncs;
|
||||
extern hashtable_t h_labels;
|
||||
|
||||
|
||||
extern int32_t g_iReturnVarID; // var ID of "RETURN"
|
||||
extern int32_t g_iWeaponVarID; // var ID of "WEAPON"
|
||||
extern int32_t g_iWorksLikeVarID; // var ID of "WORKSLIKE"
|
||||
|
@ -57,6 +57,7 @@ extern int32_t g_iPlayerVarID;
|
|||
extern int32_t g_iActorVarID;
|
||||
|
||||
extern intptr_t *apScriptGameEvent[MAXGAMEEVENTS];
|
||||
#endif
|
||||
|
||||
extern int32_t otherp;
|
||||
extern int32_t lastvisinc;
|
||||
|
@ -68,6 +69,9 @@ extern int32_t g_scriptVersion;
|
|||
extern uint32_t g_scriptDateVersion; // YYYYMMDD
|
||||
extern char g_szBuf[1024];
|
||||
|
||||
extern const char *EventNames[]; // MAXEVENTS
|
||||
|
||||
#if !defined LUNATIC
|
||||
extern intptr_t *g_scriptPtr;
|
||||
|
||||
typedef struct
|
||||
|
@ -78,7 +82,6 @@ typedef struct
|
|||
int32_t maxParm2;
|
||||
} memberlabel_t;
|
||||
|
||||
extern const char *EventNames[]; // MAXEVENTS
|
||||
extern const memberlabel_t SectorLabels[];
|
||||
extern const memberlabel_t WallLabels[];
|
||||
extern const memberlabel_t ActorLabels[];
|
||||
|
@ -87,28 +90,11 @@ extern const memberlabel_t ProjectileLabels[];
|
|||
extern const memberlabel_t userdeflabels[];
|
||||
extern const memberlabel_t InputLabels[];
|
||||
extern const memberlabel_t TsprLabels[];
|
||||
#endif
|
||||
|
||||
int32_t C_AllocQuote(int32_t qnum);
|
||||
void C_InitQuotes(void);
|
||||
|
||||
void C_ReportError(int32_t iError);
|
||||
#if !defined LUNATIC
|
||||
void C_Compile(const char *filenam);
|
||||
#endif
|
||||
|
||||
/*
|
||||
extern void VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t lVar2);
|
||||
extern void VM_AccessActiveProjectile(int32_t iSet, int32_t lVar1, int32_t lLabelID, int32_t lVar2);
|
||||
extern void VM_AccessPlayer(int32_t iSet, int32_t lVar1, int32_t lLabelID, int32_t lVar2, int32_t lParm2);
|
||||
extern void VM_AccessPlayerInput(int32_t iSet, int32_t lVar1, int32_t lLabelID, int32_t lVar2);
|
||||
extern void VM_AccessWall(int32_t iSet, int32_t lVar1, int32_t lLabelID, int32_t lVar2);
|
||||
extern void VM_AccessSector(int32_t iSet, int32_t lVar1, int32_t lLabelID, int32_t lVar2);
|
||||
extern void VM_AccessSprite(int32_t iSet, int32_t lVar1, int32_t lLabelID, int32_t lVar2, int32_t lParm2);
|
||||
extern void VM_AccessTsprite(int32_t iSet, int32_t lVar1, int32_t lLabelID, int32_t lVar2);
|
||||
extern void VM_AccessProjectile(int32_t iSet, int32_t lVar1, int32_t lLabelID, int32_t lVar2);
|
||||
*/
|
||||
|
||||
|
||||
typedef struct {
|
||||
int32_t g_i, g_p, g_x;
|
||||
int32_t *g_t;
|
||||
|
@ -118,6 +104,10 @@ typedef struct {
|
|||
|
||||
extern vmstate_t vm;
|
||||
|
||||
#if !defined LUNATIC
|
||||
void C_ReportError(int32_t iError);
|
||||
void C_Compile(const char *filenam);
|
||||
|
||||
extern int32_t g_errorLineNum;
|
||||
extern int32_t g_tw;
|
||||
extern const char *keyw[];
|
||||
|
@ -946,3 +936,6 @@ enum ScriptKeywords_t
|
|||
CON_END
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -5388,7 +5388,7 @@ void G_SaveMapState(mapstate_t *save)
|
|||
Bmemcpy(&save->lockclock,&lockclock,sizeof(lockclock));
|
||||
Bmemcpy(&save->randomseed,&randomseed,sizeof(randomseed));
|
||||
Bmemcpy(&save->g_globalRandom,&g_globalRandom,sizeof(g_globalRandom));
|
||||
|
||||
#if !defined LUNATIC
|
||||
for (i=g_gameVarCount-1; i>=0; i--)
|
||||
{
|
||||
if (aGameVars[i].dwFlags & GAMEVAR_NORESET) continue;
|
||||
|
@ -5406,7 +5406,7 @@ void G_SaveMapState(mapstate_t *save)
|
|||
}
|
||||
else save->vars[i] = (intptr_t *)aGameVars[i].val.lValue;
|
||||
}
|
||||
|
||||
#endif
|
||||
ototalclock = totalclock;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1069,8 +1069,7 @@ void Gv_ResetSystemDefaults(void)
|
|||
aplWeaponFlashColor[i][j]=Gv_GetVarByLabel(aszBuf,0, -1, j);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#if !defined LUNATIC
|
||||
|
||||
g_iReturnVarID=Gv_GetVarIndex("RETURN");
|
||||
g_iWeaponVarID=Gv_GetVarIndex("WEAPON");
|
||||
g_iWorksLikeVarID=Gv_GetVarIndex("WORKSLIKE");
|
||||
|
|
|
@ -48,6 +48,8 @@ enum GamevarFlags_t {
|
|||
GAMEVAR_NOMULTI = 0x00080000, // don't attach to multiplayer packets
|
||||
};
|
||||
|
||||
#if !defined LUNATIC
|
||||
|
||||
#define MAXGAMEARRAYS (MAXGAMEVARS>>2) // must be lower than MAXGAMEVARS
|
||||
#define MAXARRAYLABEL MAXVARLABEL
|
||||
|
||||
|
@ -94,15 +96,11 @@ extern gamearray_t aGameArrays[MAXGAMEARRAYS];
|
|||
extern int32_t g_gameVarCount;
|
||||
extern int32_t g_gameArrayCount;
|
||||
|
||||
#if defined LUNATIC
|
||||
# define Gv_GetVar(id, iActor, iPlayer) 0 // (OSD_Printf("Gv_GetVar @ %s:%d\n", __FILE__, __LINE__), 0)
|
||||
# define Gv_SetVar(id, lValue, iActor, iPlayer) do{}while(0) //OSD_Printf("Gv_SetVar @ %s:%d\n", __FILE__, __LINE__)
|
||||
#else
|
||||
int32_t __fastcall Gv_GetVar(register int32_t id,register int32_t iActor,register int32_t iPlayer);
|
||||
void __fastcall Gv_SetVar(register int32_t id,register int32_t lValue,register int32_t iActor,register int32_t iPlayer);
|
||||
#endif
|
||||
int32_t __fastcall Gv_GetVarX(register int32_t id);
|
||||
void __fastcall Gv_SetVarX(register int32_t id,register int32_t lValue);
|
||||
#endif
|
||||
|
||||
#ifdef LUNATIC
|
||||
# define Gv_GetVarByLabel(szGameLabel, lDefault, iActor, iPlayer) (lDefault)
|
||||
|
@ -122,6 +120,7 @@ int32_t Gv_ReadSave(int32_t fil,int32_t newbehav);
|
|||
void Gv_Init(void);
|
||||
void Gv_WriteSave(FILE *fil,int32_t newbehav);
|
||||
|
||||
#if !defined LUNATIC
|
||||
#define GV_VAROP(func, operator) static inline void __fastcall func(register int32_t id, register int32_t lValue) \
|
||||
{ \
|
||||
switch (aGameVars[id].dwFlags & (GAMEVAR_USER_MASK|GAMEVAR_PTR_MASK)) \
|
||||
|
@ -157,5 +156,6 @@ GV_VAROP(Gv_ModVar, %=)
|
|||
GV_VAROP(Gv_AndVar, &=)
|
||||
GV_VAROP(Gv_XorVar, ^=)
|
||||
GV_VAROP(Gv_OrVar, |=)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1312,10 +1312,6 @@ setmtonce(gv, tmpmt)
|
|||
-- This will create 'sprite', 'wall', etc. HERE, i.e. in the environment of this chunk
|
||||
defs_c.create_globals(_G)
|
||||
|
||||
function TEMP_getvollev() -- REMOVE
|
||||
return ffiC.ud.volume_number+1, ffiC.ud.level_number+1
|
||||
end
|
||||
|
||||
|
||||
---=== Game variables ===---
|
||||
|
||||
|
|
|
@ -202,6 +202,12 @@ local function new_initial_gvartab()
|
|||
STICKYBOMB_LIFETIME = RW(PLS".tripbombLifetime"),
|
||||
STICKYBOMB_LIFETIME_VAR = RW(PLS".tripbombLifetimeVar"),
|
||||
|
||||
-- These are not 100% authentic (they're only updated in certain
|
||||
-- circumstances, see player.c: P_SetWeaponGamevars()). But IMO it's
|
||||
-- more useful like this.
|
||||
WEAPON = RO(PLS".curr_weapon"),
|
||||
WORKSLIKE = RO(format(PLS".weapon[%s].workslike", PLS".curr_weapon")),
|
||||
|
||||
VOLUME = RO "_gv.currentEpisode()",
|
||||
LEVEL = RO "_gv.currentLevel()",
|
||||
}
|
||||
|
|
|
@ -64,9 +64,8 @@ for i = 0, gv.numsectors/2 do
|
|||
sector[i].ceilingpal = 2;
|
||||
end
|
||||
|
||||
local vol, lev
|
||||
vol, lev = TEMP_getvollev()
|
||||
print('volume='..vol..', level='..lev)
|
||||
local vol, lev = gv.currentEpisode()+1, gv.currentLevel()+1
|
||||
printf('volume=%d, level=%d', vol, lev)
|
||||
|
||||
if (vol==1 and lev==1) then -- E1L1
|
||||
print('tweaking some sprites 2')
|
||||
|
@ -203,10 +202,14 @@ gameevent(gv.EVENT_JUMP,
|
|||
-- test event chaining
|
||||
gameevent("JUMP",
|
||||
function(actori, playeri, dist)
|
||||
local ps = player[playeri]
|
||||
print("I'm first!")
|
||||
-- DBG_.oom()
|
||||
player[playeri].weapon.PISTOL.shoots = 2605 -- RPG
|
||||
player[playeri].weapon[gv.PISTOL_WEAPON].firesound = 351 -- thunder
|
||||
ps.weapon.PISTOL.shoots = 2605 -- RPG
|
||||
ps.weapon[gv.PISTOL_WEAPON].firesound = 351 -- thunder
|
||||
|
||||
ps.pipebombControl = 2
|
||||
ps.tripbombControl = 2
|
||||
end
|
||||
)
|
||||
|
||||
|
|
|
@ -533,6 +533,7 @@ static int32_t osdcmd_spawn(const osdfuncparm_t *parm)
|
|||
return OSDCMD_OK;
|
||||
}
|
||||
|
||||
#if !defined LUNATIC
|
||||
static int32_t osdcmd_setvar(const osdfuncparm_t *parm)
|
||||
{
|
||||
int32_t i, varval;
|
||||
|
@ -612,6 +613,7 @@ static int32_t osdcmd_setactorvar(const osdfuncparm_t *parm)
|
|||
Gv_SetVar(i, varval, ID, -1);
|
||||
return OSDCMD_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int32_t osdcmd_addpath(const osdfuncparm_t *parm)
|
||||
{
|
||||
|
@ -1595,11 +1597,12 @@ int32_t registerosdcommands(void)
|
|||
|
||||
OSD_RegisterFunction("restartsound","restartsound: reinitializes the sound system",osdcmd_restartsound);
|
||||
OSD_RegisterFunction("restartvid","restartvid: reinitializes the video mode",osdcmd_restartvid);
|
||||
|
||||
#if !defined LUNATIC
|
||||
OSD_RegisterFunction("addlogvar","addlogvar <gamevar>: prints the value of a gamevar", osdcmd_addlogvar);
|
||||
OSD_RegisterFunction("setvar","setvar <gamevar> <value>: sets the value of a gamevar", osdcmd_setvar);
|
||||
OSD_RegisterFunction("setvarvar","setvarvar <gamevar1> <gamevar2>: sets the value of <gamevar1> to <gamevar2>", osdcmd_setvar);
|
||||
OSD_RegisterFunction("setactorvar","setactorvar <actor#> <gamevar> <value>: sets the value of <actor#>'s <gamevar> to <value>", osdcmd_setactorvar);
|
||||
#endif
|
||||
OSD_RegisterFunction("screenshot","screenshot: takes a screenshot. See r_scrcaptureformat.", osdcmd_screenshot);
|
||||
|
||||
OSD_RegisterFunction("spawn","spawn <picnum> [palnum] [cstat] [ang] [x y z]: spawns a sprite with the given properties",osdcmd_spawn);
|
||||
|
|
|
@ -39,6 +39,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
#ifdef LUNATIC
|
||||
# include "lunatic_game.h"
|
||||
|
||||
int32_t g_testLua = 0;
|
||||
#endif
|
||||
|
||||
static int32_t g_whichPalForPlayer = 9;
|
||||
|
@ -1373,17 +1375,20 @@ static inline void prelevel(char g)
|
|||
}
|
||||
}
|
||||
|
||||
#if 0 //def LUNATIC
|
||||
if (L_IsInitialized(&g_ElState))
|
||||
#ifdef LUNATIC
|
||||
if (g_testLua)
|
||||
{
|
||||
i = L_RunOnce(&g_ElState, "test.elua");
|
||||
if (i)
|
||||
OSD_Printf(OSD_ERROR "Error running the test ELua script (code %d)\n", i);
|
||||
if (L_IsInitialized(&g_ElState))
|
||||
{
|
||||
i = L_RunOnce(&g_ElState, "test.elua");
|
||||
if (i)
|
||||
OSD_Printf(OSD_ERROR "Error running the test ELua script (code %d)\n", i);
|
||||
else
|
||||
initprintf("ELua test script run ok!\n");
|
||||
}
|
||||
else
|
||||
initprintf("ELua test script run ok!\n");
|
||||
initprintf("ELua test script: not inited!\n");
|
||||
}
|
||||
else
|
||||
initprintf("ELua test script: not inited!\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -2051,7 +2056,7 @@ int32_t G_EnterLevel(int32_t g)
|
|||
void G_FreeMapState(int32_t mapnum)
|
||||
{
|
||||
int32_t j;
|
||||
|
||||
#if !defined LUNATIC
|
||||
for (j=0; j<g_gameVarCount; j++)
|
||||
{
|
||||
if (aGameVars[j].dwFlags & GAMEVAR_NORESET) continue;
|
||||
|
@ -2066,6 +2071,7 @@ void G_FreeMapState(int32_t mapnum)
|
|||
Bfree(MapInfo[mapnum].savedstate->vars[j]);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
Bfree(MapInfo[mapnum].savedstate);
|
||||
MapInfo[mapnum].savedstate = NULL;
|
||||
}
|
||||
|
|
|
@ -1045,6 +1045,7 @@ static uint8_t *svdiff;
|
|||
// setup gamevar data spec for snapshotting and diffing... gamevars must be loaded when called
|
||||
static void sv_makevarspec()
|
||||
{
|
||||
#if !defined LUNATIC
|
||||
static char *magic = "blK:vars";
|
||||
int32_t i, j, numsavedvars=0, per;
|
||||
|
||||
|
@ -1085,6 +1086,7 @@ static void sv_makevarspec()
|
|||
}
|
||||
|
||||
svgm_vars[j].flags = DS_END;
|
||||
#endif
|
||||
}
|
||||
|
||||
void sv_freemem()
|
||||
|
|
Loading…
Reference in a new issue