Minor gamevar stuff

git-svn-id: https://svn.eduke32.com/eduke32@193 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2006-06-19 19:28:49 +00:00
parent 1ff7e005d6
commit 0d61f3bc55
5 changed files with 32 additions and 31 deletions

View file

@ -3283,7 +3283,7 @@ void movetransports(void)
ps[p].jumping_toggle = 1; ps[p].jumping_toggle = 1;
ps[p].jumping_counter = 0; ps[p].jumping_counter = 0;
// ps[p].poszv += 1024; // ps[p].poszv += 1024;
} }
if(k == 1) if(k == 1)

View file

@ -252,7 +252,7 @@ enum weapons {
#define ESCESCAPE if(KB_KeyPressed( sc_Escape ) ) gameexit(" "); #define ESCESCAPE if(KB_KeyPressed( sc_Escape ) ) gameexit(" ");
#define IFWITHIN(B,E) if((PN)>=(B) && (PN)<=(E)) #define IFWITHIN(B,E) if((PN)>=(B) && (PN)<=(E))
#define KILLIT(KX) {ResetActorGameVars(KX);deletesprite(KX);goto BOLT;} #define KILLIT(KX) {deletesprite(KX);goto BOLT;}
#define IFMOVING if(ssp(i,CLIPMASK0)) #define IFMOVING if(ssp(i,CLIPMASK0))
@ -517,6 +517,8 @@ extern long partime[MAXVOLUMES*11],designertime[MAXVOLUMES*11];
extern char volume_names[MAXVOLUMES][33]; extern char volume_names[MAXVOLUMES][33];
extern char skill_names[5][33]; extern char skill_names[5][33];
extern int framerate;
#define MAXGAMETYPES 32 #define MAXGAMETYPES 32
extern char gametype_names[MAXGAMETYPES][33]; extern char gametype_names[MAXGAMETYPES][33];
extern int gametype_flags[MAXGAMETYPES]; extern int gametype_flags[MAXGAMETYPES];
@ -705,7 +707,7 @@ enum gamevarflags {
GAMEVAR_FLAG_USER_MASK = 3, GAMEVAR_FLAG_USER_MASK = 3,
GAMEVAR_FLAG_DEFAULT = 256, // allow override GAMEVAR_FLAG_DEFAULT = 256, // allow override
GAMEVAR_FLAG_SECRET = 512, // don't dump... GAMEVAR_FLAG_SECRET = 512, // don't dump...
GAMEVAR_FLAG_NODEFAULT = 1024, // don't add to 'default' array. GAMEVAR_FLAG_NODEFAULT = 1024, // don't reset on actor spawn
GAMEVAR_FLAG_SYSTEM = 2048, // cannot change mode flags...(only default value) GAMEVAR_FLAG_SYSTEM = 2048, // cannot change mode flags...(only default value)
GAMEVAR_FLAG_READONLY = 4096, // values are read-only (no setvar allowed) GAMEVAR_FLAG_READONLY = 4096, // values are read-only (no setvar allowed)
GAMEVAR_FLAG_PLONG = 8192, // plValue is a pointer to a long GAMEVAR_FLAG_PLONG = 8192, // plValue is a pointer to a long

View file

@ -2038,8 +2038,12 @@ void tics(void)
if (i != frameval[framecnt]) if (i != frameval[framecnt])
{ {
j=(TICRATE*AVERAGEFRAMES)/(i-frameval[framecnt]); j=(TICRATE*AVERAGEFRAMES)/(i-frameval[framecnt]);
Bsprintf(b,"%ld",j>0?j:0); if (ud.tickrate && !(ps[myconnectindex].gm&MODE_MENU))
minitext(320-strlen(b)*4,ud.screen_size!=0?(ud.multimode>1&&ud.multimode<5?9:(ud.multimode>4?17:1)):1,b,(TICRATE*AVERAGEFRAMES)/(i-frameval[framecnt]) < 40?2:0,26); {
Bsprintf(b,"%ld",j>0?j:0);
minitext(320-strlen(b)*4,ud.screen_size!=0?(ud.multimode>1&&ud.multimode<5?9:(ud.multimode>4?17:1)):1,b,(TICRATE*AVERAGEFRAMES)/(i-frameval[framecnt]) < 40?2:0,26);
}
framerate = j;
frameval[framecnt] = i; frameval[framecnt] = i;
} }
framecnt = ((framecnt+1)&(AVERAGEFRAMES-1)); framecnt = ((framecnt+1)&(AVERAGEFRAMES-1));
@ -3020,8 +3024,8 @@ void displayrest(long smoothratio)
if(ud.coords) if(ud.coords)
coords(screenpeek); coords(screenpeek);
if(ud.tickrate&&!(ps[myconnectindex].gm&MODE_MENU))
tics(); tics();
// JBF 20040124: display level stats in screen corner // JBF 20040124: display level stats in screen corner
if(ud.levelstats && (ps[myconnectindex].gm&MODE_MENU) == 0) { if(ud.levelstats && (ps[myconnectindex].gm&MODE_MENU) == 0) {
@ -3815,7 +3819,7 @@ short spawn( short j, short pn )
else else
{ {
i = pn; i = pn;
ResetActorGameVars(i);
hittype[i].picnum = PN; hittype[i].picnum = PN;
hittype[i].timetosleep = 0; hittype[i].timetosleep = 0;
hittype[i].extra = -1; hittype[i].extra = -1;

View file

@ -81,7 +81,6 @@ MATTGAMEVAR aGameVars[MAXGAMEVARS];
int iGameVarCount=0; int iGameVarCount=0;
MATTGAMEVAR aDefaultGameVars[MAXGAMEVARS]; // the 'original' values MATTGAMEVAR aDefaultGameVars[MAXGAMEVARS]; // the 'original' values
int iDefaultGameVarCount=0;
void ReportError(int iError); void ReportError(int iError);
void FreeGameVars(void); void FreeGameVars(void);
@ -1229,13 +1228,14 @@ void ResetGameVars(void)
//AddLog("Reset Game Vars"); //AddLog("Reset Game Vars");
FreeGameVars(); FreeGameVars();
for(i=0;i<iDefaultGameVarCount;i++) for(i=0;i<MAXGAMEVARS;i++)
{ {
//Bsprintf(g_szBuf,"Resetting %d: '%s' to %ld",i,aDefaultGameVars[i].szLabel, //Bsprintf(g_szBuf,"Resetting %d: '%s' to %ld",i,aDefaultGameVars[i].szLabel,
// aDefaultGameVars[i].lValue // aDefaultGameVars[i].lValue
// ); // );
//AddLog(g_szBuf); //AddLog(g_szBuf);
AddGameVar(aDefaultGameVars[i].szLabel,aDefaultGameVars[i].lValue,aDefaultGameVars[i].dwFlags|GAMEVAR_FLAG_NODEFAULT); if(aDefaultGameVars[i].szLabel != NULL)
AddGameVar(aDefaultGameVars[i].szLabel,aDefaultGameVars[i].lValue,aDefaultGameVars[i].dwFlags);
} }
} }
@ -1298,10 +1298,7 @@ char AddGameVar(char *pszLabel, long lValue, unsigned long dwFlags)
//} //}
// if existing is system, they only get to change default value.... // if existing is system, they only get to change default value....
aGameVars[i].lValue=lValue; aGameVars[i].lValue=lValue;
if(!(dwFlags & GAMEVAR_FLAG_NODEFAULT)) aDefaultGameVars[i].lValue=lValue;
{
aDefaultGameVars[i].lValue=lValue;
}
} }
else else
{ {
@ -1310,24 +1307,17 @@ char AddGameVar(char *pszLabel, long lValue, unsigned long dwFlags)
Bstrcpy(aGameVars[i].szLabel,pszLabel); Bstrcpy(aGameVars[i].szLabel,pszLabel);
aGameVars[i].dwFlags=dwFlags; aGameVars[i].dwFlags=dwFlags;
aGameVars[i].lValue=lValue; aGameVars[i].lValue=lValue;
if(!(dwFlags & GAMEVAR_FLAG_NODEFAULT)) if(aDefaultGameVars[i].szLabel == NULL)
{ aDefaultGameVars[i].szLabel=Bcalloc(MAXVARLABEL,sizeof(char));
if(aDefaultGameVars[i].szLabel == NULL) Bstrcpy(aDefaultGameVars[i].szLabel,pszLabel);
aDefaultGameVars[i].szLabel=Bcalloc(MAXVARLABEL,sizeof(char)); aDefaultGameVars[i].dwFlags=dwFlags;
Bstrcpy(aDefaultGameVars[i].szLabel,pszLabel); aDefaultGameVars[i].lValue=lValue;
aDefaultGameVars[i].dwFlags=dwFlags;
aDefaultGameVars[i].lValue=lValue;
}
} }
if(i==iGameVarCount) if(i==iGameVarCount)
{ {
// we're adding a new one. // we're adding a new one.
iGameVarCount++; iGameVarCount++;
if(!(dwFlags & GAMEVAR_FLAG_NODEFAULT))
{
iDefaultGameVarCount++;
}
} }
if(aGameVars[i].plValues && !(aGameVars[i].dwFlags & GAMEVAR_FLAG_SYSTEM)) if(aGameVars[i].plValues && !(aGameVars[i].dwFlags & GAMEVAR_FLAG_SYSTEM))
{ {
@ -1361,10 +1351,13 @@ char AddGameVar(char *pszLabel, long lValue, unsigned long dwFlags)
void ResetActorGameVars(short sActor) void ResetActorGameVars(short sActor)
{ {
int i; int i;
// OSD_Printf("resetting vars for actor %d\n",sActor);
for(i=0;i<MAXGAMEVARS;i++) for(i=0;i<MAXGAMEVARS;i++)
if( aGameVars[i].dwFlags & GAMEVAR_FLAG_PERACTOR && !(aGameVars[i].dwFlags & GAMEVAR_FLAG_NODEFAULT)) if((aGameVars[i].dwFlags & GAMEVAR_FLAG_PERACTOR) && !(aGameVars[i].dwFlags & GAMEVAR_FLAG_NODEFAULT))
{
// OSD_Printf("reset %s (%d) to %s (%d)\n",aGameVars[i].szLabel,aGameVars[i].plValues[sActor],aDefaultGameVars[i].szLabel,aDefaultGameVars[i].lValue);
aGameVars[i].plValues[sActor]=aDefaultGameVars[i].lValue; aGameVars[i].plValues[sActor]=aDefaultGameVars[i].lValue;
}
} }
int GetGameID(char *szGameLabel) int GetGameID(char *szGameLabel)
@ -3568,7 +3561,7 @@ char parsecommand(void)
case CON_LDIST: case CON_LDIST:
case CON_TXDIST: case CON_TXDIST:
case CON_GETANGLE: case CON_GETANGLE:
transvartype(GAMEVAR_FLAG_READONLY); transvar();
break; break;
case CON_MULSCALE: case CON_MULSCALE:
transmultvars(2); transmultvars(2);
@ -4902,7 +4895,6 @@ void ClearGameVars(void)
aGameVars[i].plValues=NULL; aGameVars[i].plValues=NULL;
} }
iGameVarCount=0; iGameVarCount=0;
iDefaultGameVarCount=0;
return; return;
} }
@ -5450,6 +5442,7 @@ void AddSystemVars()
AddGameVar("yxaspect",(long)&yxaspect, GAMEVAR_FLAG_SYSTEM | GAMEVAR_FLAG_PLONG | GAMEVAR_FLAG_READONLY | GAMEVAR_FLAG_SYNCCHECK); AddGameVar("yxaspect",(long)&yxaspect, GAMEVAR_FLAG_SYSTEM | GAMEVAR_FLAG_PLONG | GAMEVAR_FLAG_READONLY | GAMEVAR_FLAG_SYNCCHECK);
AddGameVar("gravitationalconstant",(long)&gc, GAMEVAR_FLAG_SYSTEM | GAMEVAR_FLAG_PLONG); AddGameVar("gravitationalconstant",(long)&gc, GAMEVAR_FLAG_SYSTEM | GAMEVAR_FLAG_PLONG);
AddGameVar("gametype_flags",(long)&gametype_flags[ud.coop], GAMEVAR_FLAG_SYSTEM | GAMEVAR_FLAG_PLONG); AddGameVar("gametype_flags",(long)&gametype_flags[ud.coop], GAMEVAR_FLAG_SYSTEM | GAMEVAR_FLAG_PLONG);
AddGameVar("framerate",(long)&framerate, GAMEVAR_FLAG_SYSTEM | GAMEVAR_FLAG_PLONG | GAMEVAR_FLAG_READONLY | GAMEVAR_FLAG_SYNCCHECK);
AddGameVar("CLIPMASK0", CLIPMASK0, GAMEVAR_FLAG_SYSTEM|GAMEVAR_FLAG_READONLY); AddGameVar("CLIPMASK0", CLIPMASK0, GAMEVAR_FLAG_SYSTEM|GAMEVAR_FLAG_READONLY);
AddGameVar("CLIPMASK1", CLIPMASK1, GAMEVAR_FLAG_SYSTEM|GAMEVAR_FLAG_READONLY); AddGameVar("CLIPMASK1", CLIPMASK1, GAMEVAR_FLAG_SYSTEM|GAMEVAR_FLAG_READONLY);
} }

View file

@ -70,6 +70,8 @@ char sounds[NUM_SOUNDS][BMAX_PATH];
short title_zoom; short title_zoom;
int framerate;
char num_volumes = 3; char num_volumes = 3;
short timer=120; short timer=120;