- fixed gamestartup parser so that it can detect script versions again.

This commit is contained in:
Christoph Oelckers 2020-07-19 21:04:22 +02:00
parent 3028b3f3fd
commit 7d7ae9e463
5 changed files with 47 additions and 40 deletions

View file

@ -100,11 +100,10 @@ enum
GAMEFLAG_ADDON = 0x00000010,
GAMEFLAG_SHAREWARE = 0x00000020,
GAMEFLAG_DUKEBETA = 0x00000060, // includes 0x20 since it's a shareware beta
GAMEFLAG_FURY = 0x00000080,
GAMEFLAG_PLUTOPAK = 0x00000080,
GAMEFLAG_RR = 0x00000100,
GAMEFLAG_RRRA = 0x00000200,
GAMEFLAG_DEER = 0x00000400,
GAMEFLAG_RRALL = GAMEFLAG_RR | GAMEFLAG_RRRA | GAMEFLAG_DEER,
GAMEFLAG_RRALL = GAMEFLAG_RR | GAMEFLAG_RRRA,
GAMEFLAG_BLOOD = 0x00000800,
GAMEFLAG_SW = 0x00001000,
GAMEFLAG_POWERSLAVE = 0x00002000,
@ -114,6 +113,10 @@ enum
GAMEFLAG_STANDALONE = 0x00010000,
GAMEFLAGMASK = 0x0000FFFF, // flags allowed from grpinfo
// We still need these for the parsers.
GAMEFLAG_FURY = 0,
GAMEFLAG_DEER = 0,
};
@ -178,6 +181,11 @@ inline bool isWorldTour()
return g_gameType & GAMEFLAG_WORLDTOUR;
}
inline bool isPlutoPak()
{
return g_gameType & GAMEFLAG_PLUTOPAK;
}
TArray<GrpEntry> GrpScan();
void S_PauseSound(bool notmusic, bool notsfx);
void S_ResumeSound(bool notsfx);

View file

@ -359,8 +359,8 @@ static void Startup(void)
ps[0].aim_mode = 1;
ud.camerasprite = -1;
if (fileSystem.FileExists("DUKESW.BIN"))
g_Shareware = 1;
if (fileSystem.FileExists("DUKESW.BIN"))
g_gameType |= GAMEFLAG_SHAREWARE;
numplayers = 1;
playerswhenstarted = ud.multimode;

View file

@ -1743,14 +1743,33 @@ int ConCompiler::parsecommand()
case concmd_garybanjo:
case concmd_motoloopsnd:
case concmd_rndmove:
//case concmd_leavetrax: // RRDH
//case concmd_leavedroppings:
//case concmd_deploybias:
//case concmd_leavetrax: // RRDH
//case concmd_leavedroppings:
//case concmd_deploybias:
return 0;
case concmd_gamestartup:
{
// What a mess. The only way to detect which game version we are running is to count the parsed values here.
int params[34]; // 34 is the maximum for RRRA.
int pcount = 0;
for (int i = 0; i < 34; i++)
{
transnum(LABEL_DEFINE);
params[pcount++] = popscriptvalue();
if (keyword() != -1) break;
}
int pget = 0;
if (!isRR())
{
if (pcount == 30) g_gameType |= GAMEFLAG_PLUTOPAK;
else if (pcount == 31) g_gameType |= GAMEFLAG_PLUTOPAK | GAMEFLAG_WORLDTOUR;
else if (pcount != 26) I_FatalError("Invalid CONs. Cannot detect version. gamestartup has %d entries", pcount);
}
popscriptvalue();
auto parseone = [=]() { transnum(LABEL_DEFINE); return popscriptvalue(); };
auto parseone = [&]() { return params[pget++]; };
ud.const_visibility = parseone();
impact_damage = parseone();
max_player_health = parseone();
@ -1758,7 +1777,7 @@ int ConCompiler::parsecommand()
respawnactortime = parseone();
respawnitemtime = parseone();
dukefriction = parseone();
gc = parseone();
if (isPlutoPak() || isRR()) gc = parseone();
rpgblastradius = parseone();
pipebombblastradius = parseone();
shrinkerblastradius = parseone();
@ -1776,21 +1795,24 @@ int ConCompiler::parsecommand()
max_ammo_amount[7] = parseone();
max_ammo_amount[8] = parseone();
max_ammo_amount[9] = parseone();
max_ammo_amount[11] = parseone();
if (isPlutoPak() || isRR()) max_ammo_amount[11] = parseone();
if (isRR() || isWorldTour()) max_ammo_amount[12] = parseone();
camerashitable = parseone();
numfreezebounces = parseone();
freezerhurtowner = parseone();
spriteqamount = clamp(parseone(), 0, 1024);
lasermode = parseone();
if (PLUTOPAK || isRR())
{
spriteqamount = clamp(parseone(), 0, 1024);
lasermode = parseone();
}
if (isRRRA())
{
max_ammo_amount[13] = parseone();
max_ammo_amount[14] = parseone();
max_ammo_amount[16] = parseone();
}
return 0;
}
return 0;
}
return 0;
}

View file

@ -40,7 +40,6 @@ BEGIN_DUKE_NS
extern user_defs ud;
extern int rtsplaying;
extern int32_t g_Shareware;
extern int32_t cameraclock;
extern int32_t cameradist;
extern int32_t tempwallptr;
@ -71,9 +70,9 @@ extern TArray<int> ScriptCode;
#define VOLUMEALL (g_Shareware == 0)
#define PLUTOPAK (true)//g_scriptVersion >= 14)
#define VOLUMEONE (g_Shareware == 1)
#define VOLUMEALL ((g_gameType & GAMEFLAG_SHAREWARE) == 0)
#define PLUTOPAK ((g_gameType & GAMEFLAG_PLUTOPAK) != 0)
#define VOLUMEONE ((g_gameType & GAMEFLAG_SHAREWARE) != 0)
#define MOVEFIFOSIZ 256

View file

@ -1,25 +1,3 @@
//-------------------------------------------------------------------------
/*
Copyright (C) 2010 EDuke32 developers and contributors
This file is part of EDuke32.
EDuke32 is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License version 2
as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
//-------------------------------------------------------------------------
//****************************************************************************
//
// sounds.h