mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-10 23:01:50 +00:00
- Added actor replacement for DECORATE. This works at a higher level than
using duplicate DoomEdNums and will affect all attempts to spawn the replaced actor. However, because this happens for all spawns and not just at map load, the replacing actor must be compatible with the replaced actor, which means that an actor can only serve as a replacement for one of its baseclasses. For example, if you want to use a modified imp, you can use this DECORATE: actor MyImp : DoomImp replaces DoompImp { // Put changed properties here } - New: The IWAD dialog now remembers the last IWAD you picked and automatically highlights it the next time you run the game. This also applies if you check "Don't ask me this again": The IWAD selected will be the one that gets automatically loaded, not the one located first. (Using the -iwad parameter will not change the default IWAD.) In addition, you can now bring the dialog up even if you disable it by holding down SHIFT during startup. - Changed ExtractFilePath() and ExtractFileBase() to return FStrings instead of writing to a provided output buffer. ExtractFileBase() can also optionally keep the file's extension in the result. - Removed the -heapsize parameter entirely. The informational message should no longer be needed. - Removed -maxdemo parameter. There's no point to having it around since the demo buffer grows automatically. SVN r238 (trunk)
This commit is contained in:
parent
43c1ec4a74
commit
6695e255ce
20 changed files with 449 additions and 307 deletions
|
@ -1,3 +1,30 @@
|
|||
July 7, 2006
|
||||
- Added actor replacement for DECORATE. This works at a higher level than
|
||||
using duplicate DoomEdNums and will affect all attempts to spawn the
|
||||
replaced actor. However, because this happens for all spawns and not just
|
||||
at map load, the replacing actor must be compatible with the replaced
|
||||
actor, which means that an actor can only serve as a replacement for one
|
||||
of its baseclasses. For example, if you want to use a modified imp, you can
|
||||
use this DECORATE:
|
||||
actor MyImp : DoomImp replaces DoompImp
|
||||
{
|
||||
// Put changed properties here
|
||||
}
|
||||
- New: The IWAD dialog now remembers the last IWAD you picked and
|
||||
automatically highlights it the next time you run the game. This also
|
||||
applies if you check "Don't ask me this again": The IWAD selected will be
|
||||
the one that gets automatically loaded, not the one located first. (Using
|
||||
the -iwad parameter will not change the default IWAD.) In addition, you
|
||||
can now bring the dialog up even if you disable it by holding down SHIFT
|
||||
during startup.
|
||||
- Changed ExtractFilePath() and ExtractFileBase() to return FStrings instead
|
||||
of writing to a provided output buffer. ExtractFileBase() can also
|
||||
optionally keep the file's extension in the result.
|
||||
- Removed the -heapsize parameter entirely. The informational message should
|
||||
no longer be needed.
|
||||
- Removed -maxdemo parameter. There's no point to having it around since
|
||||
the demo buffer grows automatically.
|
||||
|
||||
July 3, 2006 (Changes by Graf Zahl)
|
||||
- Fixed: Changed initialization of Weapon.Kickback so that it is only done
|
||||
for direct descendants of AWeapon and not for every weapon being defined.
|
||||
|
|
|
@ -474,12 +474,13 @@ CCMD (error_fatal)
|
|||
|
||||
CCMD (dir)
|
||||
{
|
||||
char dir[256], curdir[256];
|
||||
char *match;
|
||||
FString dir;
|
||||
char curdir[256];
|
||||
const char *match;
|
||||
findstate_t c_file;
|
||||
void *file;
|
||||
|
||||
if (!getcwd (curdir, 256))
|
||||
if (!getcwd (curdir, countof(curdir)))
|
||||
{
|
||||
Printf ("Current path too long\n");
|
||||
return;
|
||||
|
@ -487,21 +488,21 @@ CCMD (dir)
|
|||
|
||||
if (argv.argc() == 1 || chdir (argv[1]))
|
||||
{
|
||||
match = argv.argc() == 1 ? (char *)"./*" : argv[1];
|
||||
match = argv.argc() == 1 ? "./*" : argv[1];
|
||||
|
||||
ExtractFilePath (match, dir);
|
||||
if (dir[0])
|
||||
dir = ExtractFilePath (match);
|
||||
if (dir[0] != '\0')
|
||||
{
|
||||
match += strlen (dir);
|
||||
match += dir.Len();
|
||||
}
|
||||
else
|
||||
{
|
||||
dir[0] = '.';
|
||||
dir[1] = '/';
|
||||
dir[2] = '\0';
|
||||
dir = "./";
|
||||
}
|
||||
if (!match[0])
|
||||
if (match[0] == '\0')
|
||||
{
|
||||
match = "*";
|
||||
}
|
||||
|
||||
if (chdir (dir))
|
||||
{
|
||||
|
@ -512,9 +513,11 @@ CCMD (dir)
|
|||
else
|
||||
{
|
||||
match = "*";
|
||||
strcpy (dir, argv[1]);
|
||||
if (dir[strlen(dir) - 1] != '/')
|
||||
strcat (dir, "/");
|
||||
dir = argv[1];
|
||||
if (dir[dir.Len()-1] != '/')
|
||||
{
|
||||
dir += '/';
|
||||
}
|
||||
}
|
||||
|
||||
if ( (file = I_FindFirst (match, &c_file)) == ((void *)(-1)))
|
||||
|
|
|
@ -166,7 +166,7 @@ Extract file parts
|
|||
*/
|
||||
// FIXME: should include the slash, otherwise
|
||||
// backing to an empty path will be wrong when appending a slash
|
||||
void ExtractFilePath (const char *path, char *dest)
|
||||
FString ExtractFilePath (const char *path)
|
||||
{
|
||||
const char *src;
|
||||
|
||||
|
@ -178,13 +178,12 @@ void ExtractFilePath (const char *path, char *dest)
|
|||
while (src != path && !IsSeperator(*(src-1)))
|
||||
src--;
|
||||
|
||||
memcpy (dest, path, src-path);
|
||||
dest[src-path] = 0;
|
||||
return FString(path, src - path);
|
||||
}
|
||||
|
||||
void ExtractFileBase (const char *path, char *dest)
|
||||
FString ExtractFileBase (const char *path, bool include_extension)
|
||||
{
|
||||
const char *src;
|
||||
const char *src, *dot;
|
||||
|
||||
src = path + strlen(path) - 1;
|
||||
|
||||
|
@ -203,12 +202,21 @@ void ExtractFileBase (const char *path, char *dest)
|
|||
}
|
||||
#endif
|
||||
|
||||
while (*src && *src != '.')
|
||||
if (!include_extension)
|
||||
{
|
||||
*dest++ = *src++;
|
||||
dot = src;
|
||||
while (*dot && *dot != '.')
|
||||
{
|
||||
dot++;
|
||||
}
|
||||
return FString(src, dot - src);
|
||||
}
|
||||
else
|
||||
{
|
||||
return FString(src);
|
||||
}
|
||||
}
|
||||
*dest = 0;
|
||||
return FString();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -35,8 +35,8 @@ void FixPathSeperator (char *path);
|
|||
void DefaultExtension (char *path, const char *extension);
|
||||
void DefaultExtension (FString &path, const char *extension);
|
||||
|
||||
void ExtractFilePath (const char *path, char *dest);
|
||||
void ExtractFileBase (const char *path, char *dest);
|
||||
FString ExtractFilePath (const char *path);
|
||||
FString ExtractFileBase (const char *path, bool keep_extension=false);
|
||||
|
||||
int ParseHex (char *str);
|
||||
int ParseNum (char *str);
|
||||
|
|
|
@ -2105,11 +2105,8 @@ void DoDehPatch (const char *patchfile, BOOL autoloading)
|
|||
if (!PatchFile)
|
||||
{
|
||||
// Couldn't find it on disk, try reading it from a lump
|
||||
strcpy (file, patchfile);
|
||||
FixPathSeperator (file);
|
||||
ExtractFileBase (file, file);
|
||||
file[8] = 0;
|
||||
lump = Wads.CheckNumForName (file);
|
||||
FString filebase(ExtractFileBase (patchfile));
|
||||
lump = Wads.CheckNumForName (filebase);
|
||||
if (lump >= 0)
|
||||
{
|
||||
filelen = Wads.LumpLength (lump);
|
||||
|
|
|
@ -151,6 +151,7 @@ extern cycle_t WallCycles, PlaneCycles, MaskedCycles, WallScanCycles;
|
|||
CVAR (Int, fraglimit, 0, CVAR_SERVERINFO);
|
||||
CVAR (Float, timelimit, 0.f, CVAR_SERVERINFO);
|
||||
CVAR (Bool, queryiwad, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG);
|
||||
CVAR (String, defaultiwad, "", CVAR_ARCHIVE|CVAR_GLOBALCONFIG);
|
||||
CVAR (Int, wipetype, 1, CVAR_ARCHIVE);
|
||||
|
||||
bool DrawFSHUD; // [RH] Draw fullscreen HUD?
|
||||
|
@ -1595,15 +1596,36 @@ static EIWADType IdentifyVersion (const char *zdoom_wad)
|
|||
"Did you install ZDoom properly? You can do either of the following:\n"
|
||||
"\n"
|
||||
"1. Place one or more of these wads in the same directory as ZDoom.\n"
|
||||
"2. Edit your zdoom.ini and add the directories of your iwads\n"
|
||||
"2. Edit your zdoom-username.ini and add the directories of your iwads\n"
|
||||
"to the list beneath [IWADSearch.Directories]");
|
||||
}
|
||||
|
||||
pickwad = 0;
|
||||
|
||||
if (!iwadparmfound && numwads > 1 && queryiwad)
|
||||
if (!iwadparmfound && numwads > 1)
|
||||
{
|
||||
pickwad = I_PickIWad (wads, (int)numwads);
|
||||
int defiwad = 0;
|
||||
|
||||
// Locate the user's prefered IWAD, if it was found.
|
||||
if (defaultiwad[0] != '\0')
|
||||
{
|
||||
for (i = 0; i < numwads; ++i)
|
||||
{
|
||||
FString basename = ExtractFileBase (wads[i].Path);
|
||||
if (stricmp (basename, defaultiwad) == 0)
|
||||
{
|
||||
defiwad = (int)i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
pickwad = I_PickIWad (wads, (int)numwads, queryiwad, defiwad);
|
||||
if (pickwad >= 0)
|
||||
{
|
||||
// The newly selected IWAD becomes the new default
|
||||
FString basename = ExtractFileBase (wads[pickwad].Path);
|
||||
defaultiwad = basename;
|
||||
}
|
||||
}
|
||||
|
||||
if (pickwad < 0)
|
||||
|
@ -2204,13 +2226,6 @@ void D_DoomMain (void)
|
|||
// about to begin the game.
|
||||
FBaseCVar::EnableNoSet ();
|
||||
|
||||
// [RH] Print an informative message if -heapsize is used
|
||||
if (Args.CheckParm ("-heapsize"))
|
||||
{
|
||||
Printf (TEXTCOLOR_ORANGE "Starting with -heapsize is unnecessary.\n"
|
||||
TEXTCOLOR_ORANGE "The zone heap is not used anymore.\n");
|
||||
}
|
||||
|
||||
// [RH] Run any saved commands from the command line or autoexec.cfg now.
|
||||
gamestate = GS_FULLCONSOLE;
|
||||
Net_NewMakeTic ();
|
||||
|
|
|
@ -208,6 +208,7 @@ PClass *PClass::CreateDerivedClass (FName name, unsigned int size)
|
|||
info->DoomEdNum = -1;
|
||||
info->OwnedStates = NULL;
|
||||
info->NumOwnedStates = 0;
|
||||
info->Replacement = NULL;
|
||||
m_RuntimeActors.Push (type);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -2150,10 +2150,7 @@ void G_RecordDemo (char* name)
|
|||
FixPathSeperator (demoname);
|
||||
DefaultExtension (demoname, ".lmp");
|
||||
v = Args.CheckValue ("-maxdemo");
|
||||
if (v)
|
||||
maxdemosize = atoi(v)*1024;
|
||||
if (maxdemosize < 0x20000)
|
||||
maxdemosize = 0x20000;
|
||||
maxdemosize = 0x20000;
|
||||
demobuffer = (byte *)M_Malloc (maxdemosize);
|
||||
|
||||
demorecording = true;
|
||||
|
|
|
@ -143,11 +143,17 @@ AInventory *AAmmo::CreateCopy (AActor *other)
|
|||
if (GetClass()->ParentClass != RUNTIME_CLASS(AAmmo))
|
||||
{
|
||||
const PClass *type = GetParentAmmo();
|
||||
assert (type->ActorInfo != NULL);
|
||||
FActorInfo *replacesave = type->ActorInfo->Replacement;
|
||||
if (!GoAway ())
|
||||
{
|
||||
Destroy ();
|
||||
}
|
||||
// If the base ammo class has a replacement defined, the replacement
|
||||
// must not be used in the inventory.
|
||||
type->ActorInfo->Replacement = NULL;
|
||||
copy = static_cast<AInventory *>(Spawn (type, 0, 0, 0));
|
||||
type->ActorInfo->Replacement = replacesave;
|
||||
copy->Amount = amount;
|
||||
copy->BecomeItem ();
|
||||
}
|
||||
|
|
15
src/info.cpp
15
src/info.cpp
|
@ -306,6 +306,21 @@ void FActorInfo::StaticSpeedSet ()
|
|||
}
|
||||
}
|
||||
|
||||
FActorInfo *FActorInfo::GetReplacement ()
|
||||
{
|
||||
if (Replacement == NULL)
|
||||
{
|
||||
return this;
|
||||
}
|
||||
// The Replacement field is temporarily NULLed to prevent
|
||||
// potential infinite recursion.
|
||||
FActorInfo *savedrep = Replacement;
|
||||
Replacement = NULL;
|
||||
FActorInfo *rep = savedrep->GetReplacement ();
|
||||
Replacement = savedrep;
|
||||
return rep;
|
||||
}
|
||||
|
||||
FDoomEdMap DoomEdMap;
|
||||
|
||||
FDoomEdMap::FDoomEdEntry *FDoomEdMap::DoomEdHash[DOOMED_HASHSIZE];
|
||||
|
|
|
@ -374,9 +374,11 @@ struct FActorInfo
|
|||
void BuildDefaults ();
|
||||
void ApplyDefaults (BYTE *defaults);
|
||||
void RegisterIDs ();
|
||||
FActorInfo *GetReplacement ();
|
||||
|
||||
PClass *Class;
|
||||
FState *OwnedStates;
|
||||
FActorInfo *Replacement;
|
||||
int NumOwnedStates;
|
||||
BYTE GameFilter;
|
||||
BYTE SpawnID;
|
||||
|
|
|
@ -173,12 +173,12 @@ public:
|
|||
|
||||
#define BEGIN_DEFAULTS(actor,game,ednum,spawnid) \
|
||||
BEGIN_DEFAULTS_PRE(actor) \
|
||||
RUNTIME_CLASS(actor), &actor::States[0], countof(actor::States), \
|
||||
RUNTIME_CLASS(actor), &actor::States[0], NULL, countof(actor::States), \
|
||||
BEGIN_DEFAULTS_POST(actor,game,ednum,spawnid)
|
||||
|
||||
#define BEGIN_STATELESS_DEFAULTS(actor,game,ednum,spawnid) \
|
||||
BEGIN_DEFAULTS_PRE(actor) \
|
||||
RUNTIME_CLASS(actor), NULL, 0, \
|
||||
RUNTIME_CLASS(actor), NULL, NULL, 0, \
|
||||
BEGIN_DEFAULTS_POST(actor,game,ednum,spawnid)
|
||||
|
||||
// IMPLEMENT_ACTOR combines IMPLEMENT_CLASS and BEGIN_DEFAULTS
|
||||
|
|
|
@ -785,6 +785,7 @@ AInventory *AActor::FindInventory (const PClass *type) const
|
|||
{
|
||||
AInventory *item;
|
||||
|
||||
assert (type->ActorInfo != NULL);
|
||||
for (item = Inventory; item != NULL; item = item->Inventory)
|
||||
{
|
||||
if (item->GetClass() == type)
|
||||
|
@ -792,6 +793,21 @@ AInventory *AActor::FindInventory (const PClass *type) const
|
|||
break;
|
||||
}
|
||||
}
|
||||
if (item == NULL && type->ActorInfo->Replacement != NULL)
|
||||
{ // Try again with a replacement type
|
||||
PClass *newtype = type->ActorInfo->GetReplacement()->Class;
|
||||
|
||||
if (newtype != type)
|
||||
{
|
||||
for (item = Inventory; item != NULL; item = item->Inventory)
|
||||
{
|
||||
if (item->GetClass() == newtype)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return item;
|
||||
}
|
||||
|
||||
|
@ -3018,6 +3034,9 @@ AActor *AActor::StaticSpawn (const PClass *type, fixed_t ix, fixed_t iy, fixed_t
|
|||
I_Error ("%s is not an actor\n", type->TypeName.GetChars());
|
||||
}
|
||||
|
||||
// Handle decorate replacements.
|
||||
type = type->ActorInfo->GetReplacement()->Class;
|
||||
|
||||
AActor *actor;
|
||||
|
||||
actor = static_cast<AActor *>(const_cast<PClass *>(type)->CreateNew ());
|
||||
|
|
|
@ -110,7 +110,6 @@ void SC_OpenFile (const char *name)
|
|||
ScriptSize = M_ReadFile (name, &filebuf);
|
||||
ScriptBuffer = (char *)filebuf;
|
||||
ScriptName = name; // This is used for error messages so the full file name is preferable
|
||||
//ExtractFileBase (name, ScriptName);
|
||||
FreeScript = true;
|
||||
SC_PrepareScript ();
|
||||
}
|
||||
|
|
|
@ -350,9 +350,7 @@ void I_PrintStr (const char *cp, bool scroll)
|
|||
fflush (stdout);
|
||||
}
|
||||
|
||||
EXTERN_CVAR (Bool, queryiwad)
|
||||
|
||||
int I_PickIWad (WadStuff *wads, int numwads)
|
||||
int I_PickIWad (WadStuff *wads, int numwads, bool queryiwad, int defaultiwad)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
|
|
@ -185,7 +185,7 @@ void I_PrintStr (const char *str, bool scroll);
|
|||
void I_SetTitleString (const char *title);
|
||||
|
||||
// Pick from multiple IWADs to use
|
||||
int I_PickIWad (WadStuff *wads, int numwads);
|
||||
int I_PickIWad (WadStuff *wads, int numwads, bool queryiwad, int defaultiwad);
|
||||
|
||||
// [RH] Returns millisecond-accurate time
|
||||
unsigned int I_MSTime (void);
|
||||
|
|
|
@ -1213,6 +1213,7 @@ static FActorInfo * CreateNewActor(FActorInfo ** parentc, Baggage *bag)
|
|||
{
|
||||
FName typeName;
|
||||
|
||||
// Get actor name
|
||||
SC_MustGetString();
|
||||
|
||||
char * colon = strchr(sc_String, ':');
|
||||
|
@ -1277,14 +1278,43 @@ static FActorInfo * CreateNewActor(FActorInfo ** parentc, Baggage *bag)
|
|||
FActorInfo * info = ti->ActorInfo;
|
||||
|
||||
Decorations.Push (info);
|
||||
info->NumOwnedStates=0;
|
||||
info->OwnedStates=NULL;
|
||||
info->SpawnID=0;
|
||||
info->NumOwnedStates = 0;
|
||||
info->OwnedStates = NULL;
|
||||
info->SpawnID = 0;
|
||||
|
||||
ResetBaggage (bag);
|
||||
bag->Info = info;
|
||||
|
||||
info->DoomEdNum=-1;
|
||||
info->DoomEdNum = -1;
|
||||
|
||||
// Check for "replaces"
|
||||
SC_MustGetString ();
|
||||
if (SC_Compare ("replaces"))
|
||||
{
|
||||
const PClass *replacee;
|
||||
|
||||
// Get actor name
|
||||
SC_MustGetString ();
|
||||
replacee = PClass::FindClass (sc_String);
|
||||
|
||||
if (replacee == NULL)
|
||||
{
|
||||
SC_ScriptError ("Replaced type '%s' not found", sc_String);
|
||||
}
|
||||
else if (replacee->ActorInfo == NULL)
|
||||
{
|
||||
SC_ScriptError ("Replaced type '%s' is not an actor", sc_String);
|
||||
}
|
||||
else if (!ti->IsDescendantOf (replacee))
|
||||
{
|
||||
SC_ScriptError ("'%s' must be derived from '%s' to replace it", typeName.GetChars(), sc_String);
|
||||
}
|
||||
replacee->ActorInfo->Replacement = ti->ActorInfo;
|
||||
}
|
||||
else
|
||||
{
|
||||
SC_UnGet();
|
||||
}
|
||||
|
||||
// Now, after the actor names have been parsed, it is time to switch to C-mode
|
||||
// for the rest of the actor definition.
|
||||
|
|
|
@ -655,13 +655,11 @@ void FWadCollection::AddFile (const char *filename, const char * data, int lengt
|
|||
}
|
||||
else
|
||||
{ // This is just a single lump file
|
||||
char name[PATH_MAX];
|
||||
|
||||
fileinfo2free = NULL;
|
||||
fileinfo = &singleinfo;
|
||||
singleinfo.FilePos = 0;
|
||||
singleinfo.Size = LittleLong(wadinfo->GetLength());
|
||||
ExtractFileBase (filename, name);
|
||||
FString name(ExtractFileBase (filename));
|
||||
uppercopy(singleinfo.Name, name);
|
||||
NumLumps++;
|
||||
}
|
||||
|
|
|
@ -569,7 +569,11 @@ void I_PrintStr (const char *cp, bool lineBreak)
|
|||
char buf[256];
|
||||
int bpos = 0;
|
||||
|
||||
SendMessage (edit, EM_SETSEL, (WPARAM)-1, 0);
|
||||
int selstart, selend;
|
||||
SendMessage (edit, EM_GETSEL, (WPARAM)&selstart, (LPARAM)&selend);
|
||||
|
||||
// SendMessage (edit, EM_SETSEL, (WPARAM)-1, 0);
|
||||
SendMessage (edit, EM_SETSEL, INT_MAX, INT_MAX);
|
||||
|
||||
if (lineBreak && !newLine)
|
||||
{
|
||||
|
@ -608,23 +612,35 @@ void I_PrintStr (const char *cp, bool lineBreak)
|
|||
SendMessage (edit, EM_REPLACESEL, FALSE, (LPARAM)buf);
|
||||
newLine = buf[bpos-1] == '\n';
|
||||
}
|
||||
SendMessage (edit, EM_SETSEL, selstart, selend);
|
||||
}
|
||||
|
||||
EXTERN_CVAR (Bool, queryiwad);
|
||||
static WadStuff *WadList;
|
||||
static int NumWads;
|
||||
static int DefaultWad;
|
||||
|
||||
static void SetQueryIWad (HWND dialog)
|
||||
{
|
||||
HWND checkbox = GetDlgItem (dialog, IDC_DONTASKIWAD);
|
||||
int state = SendMessage (checkbox, BM_GETCHECK, 0, 0);
|
||||
bool query = (state != BST_CHECKED);
|
||||
|
||||
queryiwad = (state != BST_CHECKED);
|
||||
if (!query && queryiwad)
|
||||
{
|
||||
MessageBox (dialog,
|
||||
"You have chosen not to show this dialog box in the future.\n"
|
||||
"If you wish to see it again, hold down SHIFT while starting " GAMENAME ".",
|
||||
"Don't ask me this again",
|
||||
MB_OK | MB_ICONINFORMATION);
|
||||
}
|
||||
|
||||
queryiwad = query;
|
||||
}
|
||||
|
||||
BOOL CALLBACK IWADBoxCallback (HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
HWND list;
|
||||
HWND ctrl;
|
||||
int i;
|
||||
|
||||
switch (message)
|
||||
|
@ -640,7 +656,7 @@ BOOL CALLBACK IWADBoxCallback (HWND hDlg, UINT message, WPARAM wParam, LPARAM lP
|
|||
SetWindowText (hDlg, newlabel.GetChars());
|
||||
}
|
||||
// Populate the list with all the IWADs found
|
||||
list = GetDlgItem (hDlg, IDC_IWADLIST);
|
||||
ctrl = GetDlgItem (hDlg, IDC_IWADLIST);
|
||||
for (i = 0; i < NumWads; i++)
|
||||
{
|
||||
FString work;
|
||||
|
@ -650,11 +666,17 @@ BOOL CALLBACK IWADBoxCallback (HWND hDlg, UINT message, WPARAM wParam, LPARAM lP
|
|||
else
|
||||
filepart++;
|
||||
work.Format ("%s (%s)", IWADTypeNames[WadList[i].Type], filepart);
|
||||
SendMessage (list, LB_ADDSTRING, 0, (LPARAM)work.GetChars());
|
||||
SendMessage (list, LB_SETITEMDATA, i, (LPARAM)i);
|
||||
SendMessage (ctrl, LB_ADDSTRING, 0, (LPARAM)work.GetChars());
|
||||
SendMessage (ctrl, LB_SETITEMDATA, i, (LPARAM)i);
|
||||
}
|
||||
SendMessage (list, LB_SETCURSEL, 0, 0);
|
||||
SetFocus (list);
|
||||
SendMessage (ctrl, LB_SETCURSEL, DefaultWad, 0);
|
||||
SetFocus (ctrl);
|
||||
// Set the state of the "Don't ask me again" checkbox
|
||||
ctrl = GetDlgItem (hDlg, IDC_DONTASKIWAD);
|
||||
SendMessage (ctrl, BM_SETCHECK, queryiwad ? BST_UNCHECKED : BST_CHECKED, 0);
|
||||
// Make sure the dialog is in front. If SHIFT was pressed to force it visible,
|
||||
// then the other window will normally be on top.
|
||||
SetForegroundWindow (hDlg);
|
||||
break;
|
||||
|
||||
case WM_COMMAND:
|
||||
|
@ -666,21 +688,26 @@ BOOL CALLBACK IWADBoxCallback (HWND hDlg, UINT message, WPARAM wParam, LPARAM lP
|
|||
(LOWORD(wParam) == IDC_IWADLIST && HIWORD(wParam) == LBN_DBLCLK))
|
||||
{
|
||||
SetQueryIWad (hDlg);
|
||||
list = GetDlgItem (hDlg, IDC_IWADLIST);
|
||||
EndDialog (hDlg, SendMessage (list, LB_GETCURSEL, 0, 0));
|
||||
ctrl = GetDlgItem (hDlg, IDC_IWADLIST);
|
||||
EndDialog (hDlg, SendMessage (ctrl, LB_GETCURSEL, 0, 0));
|
||||
}
|
||||
break;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
int I_PickIWad (WadStuff *wads, int numwads)
|
||||
int I_PickIWad (WadStuff *wads, int numwads, bool showwin, int defaultiwad)
|
||||
{
|
||||
WadList = wads;
|
||||
NumWads = numwads;
|
||||
if (showwin || GetAsyncKeyState(VK_SHIFT))
|
||||
{
|
||||
WadList = wads;
|
||||
NumWads = numwads;
|
||||
DefaultWad = defaultiwad;
|
||||
|
||||
return DialogBox (g_hInst, MAKEINTRESOURCE(IDD_IWADDIALOG),
|
||||
(HWND)Window, (DLGPROC)IWADBoxCallback);
|
||||
return DialogBox (g_hInst, MAKEINTRESOURCE(IDD_IWADDIALOG),
|
||||
(HWND)Window, (DLGPROC)IWADBoxCallback);
|
||||
}
|
||||
return defaultiwad;
|
||||
}
|
||||
|
||||
void *I_FindFirst (const char *filespec, findstate_t *fileinfo)
|
||||
|
|
|
@ -1,238 +1,238 @@
|
|||
// Emacs style mode select -*- C++ -*-
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// $Id:$
|
||||
//
|
||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||
//
|
||||
// This source is available for distribution and/or modification
|
||||
// only under the terms of the DOOM Source Code License as
|
||||
// published by id Software. All rights reserved.
|
||||
//
|
||||
// The source is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
|
||||
// for more details.
|
||||
//
|
||||
// DESCRIPTION:
|
||||
// System specific interface stuff.
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
||||
#ifndef __I_SYSTEM__
|
||||
#define __I_SYSTEM__
|
||||
|
||||
#include "d_main.h"
|
||||
#include "d_ticcmd.h"
|
||||
#include "d_event.h"
|
||||
|
||||
// Index values into the LanguageIDs array
|
||||
enum
|
||||
{
|
||||
LANGIDX_UserPreferred,
|
||||
LANGIDX_UserDefault,
|
||||
LANGIDX_SysPreferred,
|
||||
LANGIDX_SysDefault
|
||||
};
|
||||
extern DWORD LanguageIDs[4];
|
||||
extern void SetLanguageIDs ();
|
||||
|
||||
// [RH] Detects the OS the game is running under.
|
||||
void I_DetectOS (void);
|
||||
|
||||
typedef enum {
|
||||
os_unknown,
|
||||
os_Win95,
|
||||
os_WinNT,
|
||||
os_Win2k,
|
||||
os_Win32s
|
||||
} os_t;
|
||||
|
||||
extern os_t OSPlatform;
|
||||
|
||||
struct CPUInfo // 92 bytes
|
||||
{
|
||||
char VendorID[16];
|
||||
char CPUString[48];
|
||||
|
||||
BYTE Stepping;
|
||||
BYTE Model;
|
||||
BYTE Family;
|
||||
BYTE Type;
|
||||
|
||||
BYTE BrandIndex;
|
||||
BYTE CLFlush;
|
||||
BYTE CPUCount;
|
||||
BYTE APICID;
|
||||
|
||||
DWORD bSSE3:1;
|
||||
DWORD DontCare1:31;
|
||||
|
||||
DWORD bFPU:1;
|
||||
DWORD bVME:1;
|
||||
DWORD bDE:1;
|
||||
DWORD bPSE:1;
|
||||
DWORD bRDTSC:1;
|
||||
DWORD bMSR:1;
|
||||
DWORD bPAE:1;
|
||||
DWORD bMCE:1;
|
||||
DWORD bCX8:1;
|
||||
DWORD bAPIC:1;
|
||||
DWORD bReserved1:1;
|
||||
DWORD bSEP:1;
|
||||
DWORD bMTRR:1;
|
||||
DWORD bPGE:1;
|
||||
DWORD bMCA:1;
|
||||
DWORD bCMOV:1;
|
||||
DWORD bPAT:1;
|
||||
DWORD bPSE36:1;
|
||||
DWORD bPSN:1;
|
||||
DWORD bCFLUSH:1;
|
||||
DWORD bReserved2:1;
|
||||
DWORD bDS:1;
|
||||
DWORD bACPI:1;
|
||||
DWORD bMMX:1;
|
||||
DWORD bFXSR:1;
|
||||
DWORD bSSE:1;
|
||||
DWORD bSSE2:1;
|
||||
DWORD bSS:1;
|
||||
DWORD bHTT:1;
|
||||
DWORD bTM:1;
|
||||
DWORD bReserved3:1;
|
||||
DWORD bPBE:1;
|
||||
|
||||
DWORD DontCare2:22;
|
||||
DWORD bMMXPlus:1; // AMD's MMX extensions
|
||||
DWORD bMMXAgain:1; // Just a copy of bMMX above
|
||||
DWORD DontCare3:6;
|
||||
DWORD b3DNowPlus:1;
|
||||
DWORD b3DNow:1;
|
||||
|
||||
BYTE AMDStepping;
|
||||
BYTE AMDModel;
|
||||
BYTE AMDFamily;
|
||||
BYTE bIsAMD;
|
||||
|
||||
BYTE DataL1LineSize;
|
||||
BYTE DataL1LinesPerTag;
|
||||
BYTE DataL1Associativity;
|
||||
BYTE DataL1SizeKB;
|
||||
};
|
||||
|
||||
|
||||
extern "C" {
|
||||
extern CPUInfo CPU;
|
||||
}
|
||||
|
||||
// Called by DoomMain.
|
||||
void I_Init (void);
|
||||
|
||||
// Called by D_DoomLoop,
|
||||
// returns current time in tics.
|
||||
extern int (*I_GetTime) (bool saveMS);
|
||||
|
||||
// like I_GetTime, except it waits for a new tic before returning
|
||||
extern int (*I_WaitForTic) (int);
|
||||
|
||||
int I_GetTimePolled (bool saveMS);
|
||||
int I_GetTimeFake (void);
|
||||
|
||||
fixed_t I_GetTimeFrac (DWORD *ms);
|
||||
|
||||
|
||||
//
|
||||
// Called by D_DoomLoop,
|
||||
// called before processing any tics in a frame
|
||||
// (just after displaying a frame).
|
||||
// Time consuming syncronous operations
|
||||
// are performed here (joystick reading).
|
||||
// Can call D_PostEvent.
|
||||
//
|
||||
void I_StartFrame (void);
|
||||
|
||||
|
||||
//
|
||||
// Called by D_DoomLoop,
|
||||
// called before processing each tic in a frame.
|
||||
// Quick syncronous operations are performed here.
|
||||
// Can call D_PostEvent.
|
||||
void I_StartTic (void);
|
||||
|
||||
// Asynchronous interrupt functions should maintain private queues
|
||||
// that are read by the synchronous functions
|
||||
// to be converted into events.
|
||||
|
||||
// Either returns a null ticcmd,
|
||||
// or calls a loadable driver to build it.
|
||||
// This ticcmd will then be modified by the gameloop
|
||||
// for normal input.
|
||||
ticcmd_t *I_BaseTiccmd (void);
|
||||
|
||||
|
||||
// Called by M_Responder when quit is selected.
|
||||
// Clean exit, displays sell blurb.
|
||||
void I_Quit (void);
|
||||
|
||||
|
||||
void I_Tactile (int on, int off, int total);
|
||||
|
||||
void STACK_ARGS I_Error (const char *error, ...) GCCPRINTF(1,2);
|
||||
void STACK_ARGS I_FatalError (const char *error, ...) GCCPRINTF(1,2);
|
||||
|
||||
void atterm (void (*func)(void));
|
||||
void popterm ();
|
||||
|
||||
// Repaint the pre-game console
|
||||
void I_PaintConsole (void);
|
||||
|
||||
// Print a console string
|
||||
void I_PrintStr (const char *cp, bool lineBreak);
|
||||
|
||||
// Set the title string of the startup window
|
||||
void I_SetTitleString (const char *title);
|
||||
|
||||
// Pick from multiple IWADs to use
|
||||
int I_PickIWad (WadStuff *wads, int numwads);
|
||||
|
||||
// [RH] Returns millisecond-accurate time
|
||||
unsigned int I_MSTime (void);
|
||||
|
||||
// [RH] Title string to display at bottom of console during startup
|
||||
extern char DoomStartupTitle[256];
|
||||
|
||||
|
||||
// Directory searching routines
|
||||
|
||||
// Mirror WIN32_FIND_DATAA in <winbase.h>
|
||||
#ifndef MAX_PATH
|
||||
#define MAX_PATH 260
|
||||
// Emacs style mode select -*- C++ -*-
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// $Id:$
|
||||
//
|
||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||
//
|
||||
// This source is available for distribution and/or modification
|
||||
// only under the terms of the DOOM Source Code License as
|
||||
// published by id Software. All rights reserved.
|
||||
//
|
||||
// The source is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
|
||||
// for more details.
|
||||
//
|
||||
// DESCRIPTION:
|
||||
// System specific interface stuff.
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
||||
#ifndef __I_SYSTEM__
|
||||
#define __I_SYSTEM__
|
||||
|
||||
#include "d_main.h"
|
||||
#include "d_ticcmd.h"
|
||||
#include "d_event.h"
|
||||
|
||||
// Index values into the LanguageIDs array
|
||||
enum
|
||||
{
|
||||
LANGIDX_UserPreferred,
|
||||
LANGIDX_UserDefault,
|
||||
LANGIDX_SysPreferred,
|
||||
LANGIDX_SysDefault
|
||||
};
|
||||
extern DWORD LanguageIDs[4];
|
||||
extern void SetLanguageIDs ();
|
||||
|
||||
// [RH] Detects the OS the game is running under.
|
||||
void I_DetectOS (void);
|
||||
|
||||
typedef enum {
|
||||
os_unknown,
|
||||
os_Win95,
|
||||
os_WinNT,
|
||||
os_Win2k,
|
||||
os_Win32s
|
||||
} os_t;
|
||||
|
||||
extern os_t OSPlatform;
|
||||
|
||||
struct CPUInfo // 92 bytes
|
||||
{
|
||||
char VendorID[16];
|
||||
char CPUString[48];
|
||||
|
||||
BYTE Stepping;
|
||||
BYTE Model;
|
||||
BYTE Family;
|
||||
BYTE Type;
|
||||
|
||||
BYTE BrandIndex;
|
||||
BYTE CLFlush;
|
||||
BYTE CPUCount;
|
||||
BYTE APICID;
|
||||
|
||||
DWORD bSSE3:1;
|
||||
DWORD DontCare1:31;
|
||||
|
||||
DWORD bFPU:1;
|
||||
DWORD bVME:1;
|
||||
DWORD bDE:1;
|
||||
DWORD bPSE:1;
|
||||
DWORD bRDTSC:1;
|
||||
DWORD bMSR:1;
|
||||
DWORD bPAE:1;
|
||||
DWORD bMCE:1;
|
||||
DWORD bCX8:1;
|
||||
DWORD bAPIC:1;
|
||||
DWORD bReserved1:1;
|
||||
DWORD bSEP:1;
|
||||
DWORD bMTRR:1;
|
||||
DWORD bPGE:1;
|
||||
DWORD bMCA:1;
|
||||
DWORD bCMOV:1;
|
||||
DWORD bPAT:1;
|
||||
DWORD bPSE36:1;
|
||||
DWORD bPSN:1;
|
||||
DWORD bCFLUSH:1;
|
||||
DWORD bReserved2:1;
|
||||
DWORD bDS:1;
|
||||
DWORD bACPI:1;
|
||||
DWORD bMMX:1;
|
||||
DWORD bFXSR:1;
|
||||
DWORD bSSE:1;
|
||||
DWORD bSSE2:1;
|
||||
DWORD bSS:1;
|
||||
DWORD bHTT:1;
|
||||
DWORD bTM:1;
|
||||
DWORD bReserved3:1;
|
||||
DWORD bPBE:1;
|
||||
|
||||
DWORD DontCare2:22;
|
||||
DWORD bMMXPlus:1; // AMD's MMX extensions
|
||||
DWORD bMMXAgain:1; // Just a copy of bMMX above
|
||||
DWORD DontCare3:6;
|
||||
DWORD b3DNowPlus:1;
|
||||
DWORD b3DNow:1;
|
||||
|
||||
BYTE AMDStepping;
|
||||
BYTE AMDModel;
|
||||
BYTE AMDFamily;
|
||||
BYTE bIsAMD;
|
||||
|
||||
BYTE DataL1LineSize;
|
||||
BYTE DataL1LinesPerTag;
|
||||
BYTE DataL1Associativity;
|
||||
BYTE DataL1SizeKB;
|
||||
};
|
||||
|
||||
|
||||
extern "C" {
|
||||
extern CPUInfo CPU;
|
||||
}
|
||||
|
||||
// Called by DoomMain.
|
||||
void I_Init (void);
|
||||
|
||||
// Called by D_DoomLoop,
|
||||
// returns current time in tics.
|
||||
extern int (*I_GetTime) (bool saveMS);
|
||||
|
||||
// like I_GetTime, except it waits for a new tic before returning
|
||||
extern int (*I_WaitForTic) (int);
|
||||
|
||||
int I_GetTimePolled (bool saveMS);
|
||||
int I_GetTimeFake (void);
|
||||
|
||||
fixed_t I_GetTimeFrac (DWORD *ms);
|
||||
|
||||
|
||||
//
|
||||
// Called by D_DoomLoop,
|
||||
// called before processing any tics in a frame
|
||||
// (just after displaying a frame).
|
||||
// Time consuming syncronous operations
|
||||
// are performed here (joystick reading).
|
||||
// Can call D_PostEvent.
|
||||
//
|
||||
void I_StartFrame (void);
|
||||
|
||||
|
||||
//
|
||||
// Called by D_DoomLoop,
|
||||
// called before processing each tic in a frame.
|
||||
// Quick syncronous operations are performed here.
|
||||
// Can call D_PostEvent.
|
||||
void I_StartTic (void);
|
||||
|
||||
// Asynchronous interrupt functions should maintain private queues
|
||||
// that are read by the synchronous functions
|
||||
// to be converted into events.
|
||||
|
||||
// Either returns a null ticcmd,
|
||||
// or calls a loadable driver to build it.
|
||||
// This ticcmd will then be modified by the gameloop
|
||||
// for normal input.
|
||||
ticcmd_t *I_BaseTiccmd (void);
|
||||
|
||||
|
||||
// Called by M_Responder when quit is selected.
|
||||
// Clean exit, displays sell blurb.
|
||||
void I_Quit (void);
|
||||
|
||||
|
||||
void I_Tactile (int on, int off, int total);
|
||||
|
||||
void STACK_ARGS I_Error (const char *error, ...) GCCPRINTF(1,2);
|
||||
void STACK_ARGS I_FatalError (const char *error, ...) GCCPRINTF(1,2);
|
||||
|
||||
void atterm (void (*func)(void));
|
||||
void popterm ();
|
||||
|
||||
// Repaint the pre-game console
|
||||
void I_PaintConsole (void);
|
||||
|
||||
// Print a console string
|
||||
void I_PrintStr (const char *cp, bool lineBreak);
|
||||
|
||||
// Set the title string of the startup window
|
||||
void I_SetTitleString (const char *title);
|
||||
|
||||
// Pick from multiple IWADs to use
|
||||
int I_PickIWad (WadStuff *wads, int numwads, bool queryiwad, int defaultiwad);
|
||||
|
||||
// [RH] Returns millisecond-accurate time
|
||||
unsigned int I_MSTime (void);
|
||||
|
||||
// [RH] Title string to display at bottom of console during startup
|
||||
extern char DoomStartupTitle[256];
|
||||
|
||||
|
||||
// Directory searching routines
|
||||
|
||||
// Mirror WIN32_FIND_DATAA in <winbase.h>
|
||||
#ifndef MAX_PATH
|
||||
#define MAX_PATH 260
|
||||
#endif
|
||||
#ifndef PATH_MAX
|
||||
#define PATH_MAX 260
|
||||
#endif
|
||||
|
||||
struct findstate_t
|
||||
{
|
||||
DWORD Attribs;
|
||||
DWORD Times[3*2];
|
||||
DWORD Size[2];
|
||||
DWORD Reserved[2];
|
||||
char Name[MAX_PATH];
|
||||
char AltName[14];
|
||||
};
|
||||
|
||||
void *I_FindFirst (const char *filespec, findstate_t *fileinfo);
|
||||
int I_FindNext (void *handle, findstate_t *fileinfo);
|
||||
int I_FindClose (void *handle);
|
||||
|
||||
#define I_FindName(a) ((a)->Name)
|
||||
#define I_FindAttr(a) ((a)->Attribs)
|
||||
|
||||
#define FA_RDONLY 0x00000001
|
||||
#define FA_HIDDEN 0x00000002
|
||||
#define FA_SYSTEM 0x00000004
|
||||
#define FA_DIREC 0x00000010
|
||||
#define FA_ARCH 0x00000020
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
struct findstate_t
|
||||
{
|
||||
DWORD Attribs;
|
||||
DWORD Times[3*2];
|
||||
DWORD Size[2];
|
||||
DWORD Reserved[2];
|
||||
char Name[MAX_PATH];
|
||||
char AltName[14];
|
||||
};
|
||||
|
||||
void *I_FindFirst (const char *filespec, findstate_t *fileinfo);
|
||||
int I_FindNext (void *handle, findstate_t *fileinfo);
|
||||
int I_FindClose (void *handle);
|
||||
|
||||
#define I_FindName(a) ((a)->Name)
|
||||
#define I_FindAttr(a) ((a)->Attribs)
|
||||
|
||||
#define FA_RDONLY 0x00000001
|
||||
#define FA_HIDDEN 0x00000002
|
||||
#define FA_SYSTEM 0x00000004
|
||||
#define FA_DIREC 0x00000010
|
||||
#define FA_ARCH 0x00000020
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue