This commit is contained in:
Christoph Oelckers 2014-12-27 19:20:12 +01:00
commit 5c658e98ec
9 changed files with 79 additions and 26 deletions

View file

@ -185,6 +185,9 @@ static const char *KeyConfCommands[] =
"clearplayerclasses" "clearplayerclasses"
}; };
static TArray<FString> StoredStartupSets;
static bool RunningStoredStartups;
// CODE -------------------------------------------------------------------- // CODE --------------------------------------------------------------------
IMPLEMENT_CLASS (DWaitingCommand) IMPLEMENT_CLASS (DWaitingCommand)
@ -537,6 +540,18 @@ void ResetButtonStates ()
} }
} }
void C_ExecStoredSets()
{
assert(!RunningStoredStartups);
RunningStoredStartups = true;
for (unsigned i = 0; i < StoredStartupSets.Size(); ++i)
{
C_DoCommand(StoredStartupSets[i]);
}
StoredStartupSets.Clear();
RunningStoredStartups = false;
}
void C_DoCommand (const char *cmd, int keynum) void C_DoCommand (const char *cmd, int keynum)
{ {
FConsoleCommand *com; FConsoleCommand *com;
@ -612,7 +627,22 @@ void C_DoCommand (const char *cmd, int keynum)
if ( (com = FindNameInHashTable (Commands, beg, len)) ) if ( (com = FindNameInHashTable (Commands, beg, len)) )
{ {
if (gamestate != GS_STARTUP || ParsingKeyConf || if (gamestate == GS_STARTUP && !RunningStoredStartups &&
len == 3 && strnicmp(beg, "set", 3) == 0)
{
// Save setting of unknown cvars for later, in case a loaded wad has a
// CVARINFO that defines it.
FCommandLine args(beg);
if (args.argc() > 1 && FindCVar(args[1], NULL) == NULL)
{
StoredStartupSets.Push(beg);
}
else
{
com->Run(args, players[consoleplayer].mo, keynum);
}
}
else if (gamestate != GS_STARTUP || ParsingKeyConf ||
(len == 3 && strnicmp (beg, "set", 3) == 0) || (len == 3 && strnicmp (beg, "set", 3) == 0) ||
(len == 7 && strnicmp (beg, "logfile", 7) == 0) || (len == 7 && strnicmp (beg, "logfile", 7) == 0) ||
(len == 9 && strnicmp (beg, "unbindall", 9) == 0) || (len == 9 && strnicmp (beg, "unbindall", 9) == 0) ||
@ -657,12 +687,15 @@ void C_DoCommand (const char *cmd, int keynum)
} }
else else
{ // We don't know how to handle this command { // We don't know how to handle this command
char cmdname[64]; if (gamestate == GS_STARTUP && !RunningStoredStartups)
size_t minlen = MIN<size_t> (len, 63); {
// Save it for later, in case a CVARINFO defines it.
memcpy (cmdname, beg, minlen); StoredStartupSets.Push(beg);
cmdname[len] = 0; }
Printf ("Unknown command \"%s\"\n", cmdname); else
{
Printf ("Unknown command \"%.*s\"\n", len, beg);
}
} }
} }
} }

View file

@ -42,6 +42,7 @@ class APlayerPawn;
extern bool CheckCheatmode (bool printmsg = true); extern bool CheckCheatmode (bool printmsg = true);
void C_ExecCmdLineParams (); void C_ExecCmdLineParams ();
void C_ExecStoredSets();
// Add commands to the console as if they were typed in. Can handle wait // Add commands to the console as if they were typed in. Can handle wait
// and semicolon-separated commands. This function may modify the source // and semicolon-separated commands. This function may modify the source

View file

@ -2273,6 +2273,8 @@ void D_DoomMain (void)
execFiles = Args->GatherFiles ("-exec"); execFiles = Args->GatherFiles ("-exec");
D_MultiExec (execFiles, true); D_MultiExec (execFiles, true);
C_ExecCmdLineParams (); // [RH] do all +set commands on the command line
CopyFiles(allwads, pwads); CopyFiles(allwads, pwads);
// Since this function will never leave we must delete this array here manually. // Since this function will never leave we must delete this array here manually.
@ -2288,7 +2290,8 @@ void D_DoomMain (void)
// Now that wads are loaded, define mod-specific cvars. // Now that wads are loaded, define mod-specific cvars.
ParseCVarInfo(); ParseCVarInfo();
C_ExecCmdLineParams (); // [RH] do all +set commands on the command line // Try setting previously unknown cvars again, as a CVARINFO may have made them known.
C_ExecStoredSets();
// [RH] Initialize localizable strings. // [RH] Initialize localizable strings.
GStrings.LoadStrings (false); GStrings.LoadStrings (false);

View file

@ -1215,7 +1215,11 @@ public:
if(Scaled) if(Scaled)
{ {
if(cx != 0 || cy != 0) if(cx != 0 || cy != 0)
{
screen->VirtualToRealCoords(dcx, dcy, tmp, tmp, script->resW, script->resH, true); screen->VirtualToRealCoords(dcx, dcy, tmp, tmp, script->resW, script->resH, true);
if (cx == 0) dcx = 0;
if (cy == 0) dcy = 0;
}
if(cr != 0 || cb != 0 || clearDontDraw) if(cr != 0 || cb != 0 || clearDontDraw)
screen->VirtualToRealCoords(dcr, dcb, tmp, tmp, script->resW, script->resH, true); screen->VirtualToRealCoords(dcr, dcb, tmp, tmp, script->resW, script->resH, true);
screen->VirtualToRealCoords(dx, dy, w, h, script->resW, script->resH, true); screen->VirtualToRealCoords(dx, dy, w, h, script->resW, script->resH, true);

View file

@ -300,7 +300,12 @@ void FListMenuItem::DrawSelector(int xofs, int yofs, FTextureID tex)
if ((DMenu::MenuTime%8) < 6) if ((DMenu::MenuTime%8) < 6)
{ {
screen->DrawText(ConFont, OptionSettings.mFontColorSelection, screen->DrawText(ConFont, OptionSettings.mFontColorSelection,
mXpos + xofs, mYpos + yofs, "\xd", DTA_Clean, true, TAG_DONE); (mXpos + xofs - 160) * CleanXfac + screen->GetWidth() / 2,
(mYpos + yofs - 100) * CleanYfac + screen->GetHeight() / 2,
"\xd",
DTA_CellX, 8 * CleanXfac,
DTA_CellY, 8 * CleanYfac,
TAG_DONE);
} }
} }
else else

View file

@ -968,10 +968,12 @@ CCMD (dump3df)
fixed_t height=ffloors[i]->top.plane->ZatPoint(CenterSpot(sector)); fixed_t height=ffloors[i]->top.plane->ZatPoint(CenterSpot(sector));
fixed_t bheight=ffloors[i]->bottom.plane->ZatPoint(CenterSpot(sector)); fixed_t bheight=ffloors[i]->bottom.plane->ZatPoint(CenterSpot(sector));
IGNORE_FORMAT_PRE
Printf("FFloor %d @ top = %f (model = %d), bottom = %f (model = %d), flags = %B, alpha = %d %s %s\n", Printf("FFloor %d @ top = %f (model = %d), bottom = %f (model = %d), flags = %B, alpha = %d %s %s\n",
i, height / 65536., ffloors[i]->top.model->sectornum, i, height / 65536., ffloors[i]->top.model->sectornum,
bheight / 65536., ffloors[i]->bottom.model->sectornum, bheight / 65536., ffloors[i]->bottom.model->sectornum,
ffloors[i]->flags, ffloors[i]->alpha, (ffloors[i]->flags&FF_EXISTS)? "Exists":"", (ffloors[i]->flags&FF_DYNAMIC)? "Dynamic":""); ffloors[i]->flags, ffloors[i]->alpha, (ffloors[i]->flags&FF_EXISTS)? "Exists":"", (ffloors[i]->flags&FF_DYNAMIC)? "Dynamic":"");
IGNORE_FORMAT_POST
} }
} }
} }

View file

@ -7496,22 +7496,9 @@ scriptwait:
break; break;
case PCD_PRINTBINARY: case PCD_PRINTBINARY:
#if (defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && (__GNUC_MINOR__ >= 6)))) || defined(__clang__) IGNORE_FORMAT_PRE
#define HAS_DIAGNOSTIC_PRAGMA
#endif
#ifdef HAS_DIAGNOSTIC_PRAGMA
#pragma GCC diagnostic push
#ifdef __clang__
#pragma GCC diagnostic ignored "-Wformat-invalid-specifier"
#else
#pragma GCC diagnostic ignored "-Wformat="
#endif
#pragma GCC diagnostic ignored "-Wformat-extra-args"
#endif
work.AppendFormat ("%B", STACK(1)); work.AppendFormat ("%B", STACK(1));
#ifdef HAS_DIAGNOSTIC_PRAGMA IGNORE_FORMAT_POST
#pragma GCC diagnostic pop
#endif
--sp; --sp;
break; break;

View file

@ -4279,7 +4279,7 @@ CVAR(Float, chase_dist, 90.f, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
void P_AimCamera(AActor *t1, fixed_t &CameraX, fixed_t &CameraY, fixed_t &CameraZ, sector_t *&CameraSector) void P_AimCamera(AActor *t1, fixed_t &CameraX, fixed_t &CameraY, fixed_t &CameraZ, sector_t *&CameraSector)
{ {
fixed_t distance = (fixed_t)(chase_dist * FRACUNIT); fixed_t distance = (fixed_t)(clamp<double>(chase_dist, 0, 30000) * FRACUNIT);
angle_t angle = (t1->angle - ANG180) >> ANGLETOFINESHIFT; angle_t angle = (t1->angle - ANG180) >> ANGLETOFINESHIFT;
angle_t pitch = (angle_t)(t1->pitch) >> ANGLETOFINESHIFT; angle_t pitch = (angle_t)(t1->pitch) >> ANGLETOFINESHIFT;
FTraceResults trace; FTraceResults trace;
@ -4289,7 +4289,7 @@ void P_AimCamera(AActor *t1, fixed_t &CameraX, fixed_t &CameraY, fixed_t &Camera
vy = FixedMul(finecosine[pitch], finesine[angle]); vy = FixedMul(finecosine[pitch], finesine[angle]);
vz = finesine[pitch]; vz = finesine[pitch];
sz = t1->z - t1->floorclip + t1->height + (fixed_t)(chase_height * FRACUNIT); sz = t1->z - t1->floorclip + t1->height + (fixed_t)(clamp<double>(chase_height, -1000, 1000) * FRACUNIT);
if (Trace(t1->x, t1->y, sz, t1->Sector, if (Trace(t1->x, t1->y, sz, t1->Sector,
vx, vy, vz, distance, 0, 0, NULL, trace) && vx, vy, vz, distance, 0, 0, NULL, trace) &&

View file

@ -47,6 +47,24 @@
#define PRINTFISH(x) #define PRINTFISH(x)
#endif #endif
#ifdef __clang__
#define IGNORE_FORMAT_PRE \
_Pragma("GCC diagnostic push") \
_Pragma("GCC diagnostic ignored \"-Wformat-invalid-specifier\"") \
_Pragma("GCC diagnostic ignored \"-Wformat-extra-args\"")
#define IGNORE_FORMAT_POST _Pragma("GCC diagnostic pop")
#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && (__GNUC_MINOR__ >= 6)))
#define IGNORE_FORMAT_PRE \
_Pragma("GCC diagnostic push") \
_Pragma("GCC diagnostic ignored \"-Wformat=\"") \
_Pragma("GCC diagnostic ignored \"-Wformat-extra-args\"")
#define IGNORE_FORMAT_POST _Pragma("GCC diagnostic pop")
#else
#define IGNORE_FORMAT_PRE
#define IGNORE_FORMAT_POST
#endif
struct FStringData struct FStringData
{ {
unsigned int Len; // Length of string, excluding terminating null unsigned int Len; // Length of string, excluding terminating null