mirror of
https://github.com/jmarshall23/DoomRTX.git
synced 2026-08-12 08:11:10 +02:00
Quake 4 related bug fixes.
This commit is contained in:
@@ -20,7 +20,7 @@
|
||||
<LocalDebuggerCommandArgumentsHistory>+set r_fullscreen 0 +set r_mode 6|+set r_fullscreen 1 +set r_mode 6|+set r_fullscreen 1 +set r_mode 1|+set r_fullscreen 0 +set r_mode 1|</LocalDebuggerCommandArgumentsHistory>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Q4 Debug|x64'">
|
||||
<LocalDebuggerCommand>D:\projects\Doom3\Doom3.exe</LocalDebuggerCommand>
|
||||
<LocalDebuggerCommand>D:\projects\Doom3\Quake4.exe</LocalDebuggerCommand>
|
||||
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||
<LocalDebuggerCommandArguments>+set r_fullscreen 0 +set r_mode 1</LocalDebuggerCommandArguments>
|
||||
<LocalDebuggerWorkingDirectory>D:\projects\Doom3</LocalDebuggerWorkingDirectory>
|
||||
|
||||
@@ -395,7 +395,13 @@ the renderSystem is initialized
|
||||
==============
|
||||
*/
|
||||
void idConsoleLocal::LoadGraphics() {
|
||||
#ifdef QUAKE4
|
||||
// jmarshall
|
||||
charSetShader = declManager->FindMaterial("fonts/english/bigchars");
|
||||
// jmarshall end
|
||||
#else
|
||||
charSetShader = declManager->FindMaterial( "textures/bigchars" );
|
||||
#endif
|
||||
whiteShader = declManager->FindMaterial( "_white" );
|
||||
consoleShader = declManager->FindMaterial( "console" );
|
||||
}
|
||||
|
||||
+1012
-672
File diff suppressed because it is too large
Load Diff
+202
-166
@@ -2,9 +2,9 @@
|
||||
===========================================================================
|
||||
|
||||
IceTech GPL Source Code
|
||||
Copyright (C) 2026 Justin Marshall
|
||||
Copyright (C) 2026 Justin Marshall
|
||||
|
||||
This file is part of the IceTech GPL Source Code (?IceTech Source Code?).
|
||||
This file is part of the IceTech GPL Source Code (?IceTech Source Code?).
|
||||
|
||||
IceTech Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -63,7 +63,7 @@ If you have questions concerning this license or the applicable additional terms
|
||||
*/
|
||||
|
||||
typedef enum {
|
||||
DECL_TABLE = 0,
|
||||
DECL_TABLE = 0,
|
||||
DECL_MATERIAL,
|
||||
DECL_SKIN,
|
||||
DECL_SOUND,
|
||||
@@ -93,7 +93,7 @@ typedef enum {
|
||||
|
||||
// new decl types can be added here
|
||||
|
||||
DECL_MAX_TYPES = 32
|
||||
DECL_MAX_TYPES = 32
|
||||
} declType_t;
|
||||
|
||||
typedef enum {
|
||||
@@ -102,243 +102,279 @@ typedef enum {
|
||||
DS_PARSED
|
||||
} declState_t;
|
||||
|
||||
const int DECL_LEXER_FLAGS = LEXFL_NOSTRINGCONCAT | // multiple strings seperated by whitespaces are not concatenated
|
||||
LEXFL_NOSTRINGESCAPECHARS | // no escape characters inside strings
|
||||
LEXFL_ALLOWPATHNAMES | // allow path seperators in names
|
||||
LEXFL_ALLOWMULTICHARLITERALS | // allow multi character literals
|
||||
LEXFL_ALLOWBACKSLASHSTRINGCONCAT | // allow multiple strings seperated by '\' to be concatenated
|
||||
LEXFL_NOFATALERRORS; // just set a flag instead of fatal erroring
|
||||
const int DECL_LEXER_FLAGS = LEXFL_NOSTRINGCONCAT | // multiple strings seperated by whitespaces are not concatenated
|
||||
LEXFL_NOSTRINGESCAPECHARS | // no escape characters inside strings
|
||||
LEXFL_ALLOWPATHNAMES | // allow path seperators in names
|
||||
LEXFL_ALLOWMULTICHARLITERALS | // allow multi character literals
|
||||
LEXFL_ALLOWBACKSLASHSTRINGCONCAT | // allow multiple strings seperated by '\' to be concatenated
|
||||
LEXFL_NOFATALERRORS; // just set a flag instead of fatal erroring
|
||||
|
||||
|
||||
class idDeclBase {
|
||||
public:
|
||||
virtual ~idDeclBase() {};
|
||||
virtual const char * GetName( void ) const = 0;
|
||||
virtual declType_t GetType( void ) const = 0;
|
||||
virtual declState_t GetState( void ) const = 0;
|
||||
virtual bool IsImplicit( void ) const = 0;
|
||||
virtual bool IsValid( void ) const = 0;
|
||||
virtual void Invalidate( void ) = 0;
|
||||
virtual void Reload( void ) = 0;
|
||||
virtual void EnsureNotPurged( void ) = 0;
|
||||
virtual int Index( void ) const = 0;
|
||||
virtual int GetLineNum( void ) const = 0;
|
||||
virtual const char * GetFileName( void ) const = 0;
|
||||
virtual void GetText( char *text ) const = 0;
|
||||
virtual int GetTextLength( void ) const = 0;
|
||||
virtual void SetText( const char *text ) = 0;
|
||||
virtual bool ReplaceSourceFileText( void ) = 0;
|
||||
virtual bool SourceFileChanged( void ) const = 0;
|
||||
virtual void MakeDefault( void ) = 0;
|
||||
virtual bool EverReferenced( void ) const = 0;
|
||||
virtual bool SetDefaultText( void ) = 0;
|
||||
virtual const char * DefaultDefinition( void ) const = 0;
|
||||
virtual bool Parse( const char *text, const int textLength ) = 0;
|
||||
virtual void FreeData( void ) = 0;
|
||||
virtual size_t Size( void ) const = 0;
|
||||
virtual void List( void ) const = 0;
|
||||
virtual void Print( void ) const = 0;
|
||||
virtual const char* GetName(void) const = 0;
|
||||
virtual declType_t GetType(void) const = 0;
|
||||
virtual declState_t GetState(void) const = 0;
|
||||
virtual bool IsImplicit(void) const = 0;
|
||||
virtual bool IsValid(void) const = 0;
|
||||
virtual void Invalidate(void) = 0;
|
||||
virtual void Reload(void) = 0;
|
||||
virtual void EnsureNotPurged(void) = 0;
|
||||
virtual int Index(void) const = 0;
|
||||
virtual int GetLineNum(void) const = 0;
|
||||
virtual const char* GetFileName(void) const = 0;
|
||||
virtual void GetText(char* text) const = 0;
|
||||
virtual int GetTextLength(void) const = 0;
|
||||
virtual void SetText(const char* text) = 0;
|
||||
virtual bool ReplaceSourceFileText(void) = 0;
|
||||
virtual bool SourceFileChanged(void) const = 0;
|
||||
virtual void MakeDefault(void) = 0;
|
||||
virtual bool EverReferenced(void) const = 0;
|
||||
virtual bool SetDefaultText(void) = 0;
|
||||
virtual const char* DefaultDefinition(void) const = 0;
|
||||
virtual bool Parse(const char* text, const int textLength) = 0;
|
||||
virtual void FreeData(void) = 0;
|
||||
virtual size_t Size(void) const = 0;
|
||||
virtual void List(void) const = 0;
|
||||
virtual void Print(void) const = 0;
|
||||
};
|
||||
|
||||
#ifdef QUAKE4
|
||||
// Quake 4 guide/template support
|
||||
#define MAX_GUIDE_PARMS 20
|
||||
#define MAX_GUIDE_SHADER_SIZE 20480
|
||||
|
||||
class rvDeclGuide {
|
||||
private:
|
||||
idStr mName;
|
||||
idStr mParms[MAX_GUIDE_PARMS];
|
||||
idStr mDefinition;
|
||||
int mNumParms;
|
||||
|
||||
public:
|
||||
rvDeclGuide(idStr& name);
|
||||
~rvDeclGuide(void);
|
||||
|
||||
const char* GetName(void) const { return mName.c_str(); }
|
||||
int GetNumParms(void) const { return mNumParms; }
|
||||
const char* GetParm(int index) const { assert(index < mNumParms); return mParms[index].c_str(); }
|
||||
|
||||
void SetParm(int index, const char* value);
|
||||
void RemoveOuterBracing(void);
|
||||
void Parse(idLexer* src);
|
||||
bool Evaluate(idLexer* src, idStr& definition);
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
class idDecl {
|
||||
public:
|
||||
// The constructor should initialize variables such that
|
||||
// an immediate call to FreeData() does no harm.
|
||||
idDecl( void ) { base = NULL; }
|
||||
virtual ~idDecl( void ) {};
|
||||
// The constructor should initialize variables such that
|
||||
// an immediate call to FreeData() does no harm.
|
||||
idDecl(void) { base = NULL; }
|
||||
virtual ~idDecl(void) {};
|
||||
|
||||
// Returns the name of the decl.
|
||||
const char * GetName( void ) const { return base->GetName(); }
|
||||
// Returns the name of the decl.
|
||||
const char* GetName(void) const { return base->GetName(); }
|
||||
|
||||
// Returns the decl type.
|
||||
declType_t GetType( void ) const { return base->GetType(); }
|
||||
// Returns the decl type.
|
||||
declType_t GetType(void) const { return base->GetType(); }
|
||||
|
||||
// Returns the decl state which is usefull for finding out if a decl defaulted.
|
||||
declState_t GetState( void ) const { return base->GetState(); }
|
||||
// Returns the decl state which is usefull for finding out if a decl defaulted.
|
||||
declState_t GetState(void) const { return base->GetState(); }
|
||||
|
||||
// Returns true if the decl was defaulted or the text was created with a call to SetDefaultText.
|
||||
bool IsImplicit( void ) const { return base->IsImplicit(); }
|
||||
// Returns true if the decl was defaulted or the text was created with a call to SetDefaultText.
|
||||
bool IsImplicit(void) const { return base->IsImplicit(); }
|
||||
|
||||
// The only way non-manager code can have an invalid decl is if the *ByIndex()
|
||||
// call was used with forceParse = false to walk the lists to look at names
|
||||
// without touching the media.
|
||||
bool IsValid( void ) const { return base->IsValid(); }
|
||||
// The only way non-manager code can have an invalid decl is if the *ByIndex()
|
||||
// call was used with forceParse = false to walk the lists to look at names
|
||||
// without touching the media.
|
||||
bool IsValid(void) const { return base->IsValid(); }
|
||||
|
||||
// Sets state back to unparsed.
|
||||
// Used by decl editors to undo any changes to the decl.
|
||||
void Invalidate( void ) { base->Invalidate(); }
|
||||
// Sets state back to unparsed.
|
||||
// Used by decl editors to undo any changes to the decl.
|
||||
void Invalidate(void) { base->Invalidate(); }
|
||||
|
||||
// if a pointer might possible be stale from a previous level,
|
||||
// call this to have it re-parsed
|
||||
void EnsureNotPurged( void ) { base->EnsureNotPurged(); }
|
||||
// if a pointer might possible be stale from a previous level,
|
||||
// call this to have it re-parsed
|
||||
void EnsureNotPurged(void) { base->EnsureNotPurged(); }
|
||||
|
||||
// Returns the index in the per-type list.
|
||||
int Index( void ) const { return base->Index(); }
|
||||
// Returns the index in the per-type list.
|
||||
int Index(void) const { return base->Index(); }
|
||||
|
||||
// Returns the line number the decl starts.
|
||||
int GetLineNum( void ) const { return base->GetLineNum(); }
|
||||
// Returns the line number the decl starts.
|
||||
int GetLineNum(void) const { return base->GetLineNum(); }
|
||||
|
||||
// Returns the name of the file in which the decl is defined.
|
||||
const char * GetFileName( void ) const { return base->GetFileName(); }
|
||||
// Returns the name of the file in which the decl is defined.
|
||||
const char* GetFileName(void) const { return base->GetFileName(); }
|
||||
|
||||
// Returns the decl text.
|
||||
void GetText( char *text ) const { base->GetText( text ); }
|
||||
// Returns the decl text.
|
||||
void GetText(char* text) const { base->GetText(text); }
|
||||
|
||||
// Returns the length of the decl text.
|
||||
int GetTextLength( void ) const { return base->GetTextLength(); }
|
||||
// Returns the length of the decl text.
|
||||
int GetTextLength(void) const { return base->GetTextLength(); }
|
||||
|
||||
// Sets new decl text.
|
||||
void SetText( const char *text ) { base->SetText( text ); }
|
||||
// Sets new decl text.
|
||||
void SetText(const char* text) { base->SetText(text); }
|
||||
|
||||
// Saves out new text for the decl.
|
||||
// Used by decl editors to replace the decl text in the source file.
|
||||
bool ReplaceSourceFileText( void ) { return base->ReplaceSourceFileText(); }
|
||||
// Saves out new text for the decl.
|
||||
// Used by decl editors to replace the decl text in the source file.
|
||||
bool ReplaceSourceFileText(void) { return base->ReplaceSourceFileText(); }
|
||||
|
||||
// Returns true if the source file changed since it was loaded and parsed.
|
||||
bool SourceFileChanged( void ) const { return base->SourceFileChanged(); }
|
||||
// Returns true if the source file changed since it was loaded and parsed.
|
||||
bool SourceFileChanged(void) const { return base->SourceFileChanged(); }
|
||||
|
||||
// Frees data and makes the decl a default.
|
||||
void MakeDefault( void ) { base->MakeDefault(); }
|
||||
// Frees data and makes the decl a default.
|
||||
void MakeDefault(void) { base->MakeDefault(); }
|
||||
|
||||
// Returns true if the decl was ever referenced.
|
||||
bool EverReferenced( void ) const { return base->EverReferenced(); }
|
||||
// Returns true if the decl was ever referenced.
|
||||
bool EverReferenced(void) const { return base->EverReferenced(); }
|
||||
|
||||
public:
|
||||
// Sets textSource to a default text if necessary.
|
||||
// This may be overridden to provide a default definition based on the
|
||||
// decl name. For instance materials may default to an implicit definition
|
||||
// using a texture with the same name as the decl.
|
||||
virtual bool SetDefaultText( void ) { return base->SetDefaultText(); }
|
||||
// Sets textSource to a default text if necessary.
|
||||
// This may be overridden to provide a default definition based on the
|
||||
// decl name. For instance materials may default to an implicit definition
|
||||
// using a texture with the same name as the decl.
|
||||
virtual bool SetDefaultText(void) { return base->SetDefaultText(); }
|
||||
|
||||
// Each declaration type must have a default string that it is guaranteed
|
||||
// to parse acceptably. When a decl is not explicitly found, is purged, or
|
||||
// has an error while parsing, MakeDefault() will do a FreeData(), then a
|
||||
// Parse() with DefaultDefinition(). The defaultDefintion should start with
|
||||
// an open brace and end with a close brace.
|
||||
virtual const char * DefaultDefinition( void ) const { return base->DefaultDefinition(); }
|
||||
// Each declaration type must have a default string that it is guaranteed
|
||||
// to parse acceptably. When a decl is not explicitly found, is purged, or
|
||||
// has an error while parsing, MakeDefault() will do a FreeData(), then a
|
||||
// Parse() with DefaultDefinition(). The defaultDefintion should start with
|
||||
// an open brace and end with a close brace.
|
||||
virtual const char* DefaultDefinition(void) const { return base->DefaultDefinition(); }
|
||||
|
||||
// The manager will have already parsed past the type, name and opening brace.
|
||||
// All necessary media will be touched before return.
|
||||
// The manager will have called FreeData() before issuing a Parse().
|
||||
// The subclass can call MakeDefault() internally at any point if
|
||||
// there are parse errors.
|
||||
virtual bool Parse( const char *text, const int textLength ) { return base->Parse( text, textLength ); }
|
||||
// The manager will have already parsed past the type, name and opening brace.
|
||||
// All necessary media will be touched before return.
|
||||
// The manager will have called FreeData() before issuing a Parse().
|
||||
// The subclass can call MakeDefault() internally at any point if
|
||||
// there are parse errors.
|
||||
virtual bool Parse(const char* text, const int textLength) { return base->Parse(text, textLength); }
|
||||
|
||||
// Frees any pointers held by the subclass. This may be called before
|
||||
// any Parse(), so the constructor must have set sane values. The decl will be
|
||||
// invalid after issuing this call, but it will always be immediately followed
|
||||
// by a Parse()
|
||||
virtual void FreeData( void ) { base->FreeData(); }
|
||||
// Frees any pointers held by the subclass. This may be called before
|
||||
// any Parse(), so the constructor must have set sane values. The decl will be
|
||||
// invalid after issuing this call, but it will always be immediately followed
|
||||
// by a Parse()
|
||||
virtual void FreeData(void) { base->FreeData(); }
|
||||
|
||||
// Returns the size of the decl in memory.
|
||||
virtual size_t Size( void ) const { return base->Size(); }
|
||||
// Returns the size of the decl in memory.
|
||||
virtual size_t Size(void) const { return base->Size(); }
|
||||
|
||||
// If this isn't overridden, it will just print the decl name.
|
||||
// The manager will have printed 7 characters on the line already,
|
||||
// containing the reference state and index number.
|
||||
virtual void List( void ) const { base->List(); }
|
||||
// If this isn't overridden, it will just print the decl name.
|
||||
// The manager will have printed 7 characters on the line already,
|
||||
// containing the reference state and index number.
|
||||
virtual void List(void) const { base->List(); }
|
||||
|
||||
// The print function will already have dumped the text source
|
||||
// and common data, subclasses can override this to dump more
|
||||
// explicit data.
|
||||
virtual void Print( void ) const { base->Print(); }
|
||||
// The print function will already have dumped the text source
|
||||
// and common data, subclasses can override this to dump more
|
||||
// explicit data.
|
||||
virtual void Print(void) const { base->Print(); }
|
||||
|
||||
public:
|
||||
idDeclBase * base;
|
||||
idDeclBase* base;
|
||||
};
|
||||
|
||||
|
||||
template< class type >
|
||||
ID_INLINE idDecl *idDeclAllocator( void ) {
|
||||
ID_INLINE idDecl* idDeclAllocator(void) {
|
||||
return new type;
|
||||
}
|
||||
|
||||
|
||||
class idMaterial;
|
||||
class idDeclTable;
|
||||
class idDeclSkin;
|
||||
class idSoundShader;
|
||||
|
||||
class idDeclManager {
|
||||
public:
|
||||
virtual ~idDeclManager( void ) {}
|
||||
virtual ~idDeclManager(void) {}
|
||||
|
||||
virtual void Init( void ) = 0;
|
||||
virtual void Shutdown( void ) = 0;
|
||||
virtual void Reload( bool force ) = 0;
|
||||
virtual void Init(void) = 0;
|
||||
virtual void Shutdown(void) = 0;
|
||||
virtual void Reload(bool force) = 0;
|
||||
|
||||
virtual void BeginLevelLoad() = 0;
|
||||
virtual void EndLevelLoad() = 0;
|
||||
|
||||
// Registers a new decl type.
|
||||
virtual void RegisterDeclType( const char *typeName, declType_t type, idDecl *(*allocator)( void ) ) = 0;
|
||||
// Registers a new decl type.
|
||||
virtual void RegisterDeclType(const char* typeName, declType_t type, idDecl* (*allocator)(void)) = 0;
|
||||
|
||||
// Registers a new folder with decl files.
|
||||
virtual void RegisterDeclFolder( const char *folder, const char *extension, declType_t defaultType ) = 0;
|
||||
// Registers a new folder with decl files.
|
||||
virtual void RegisterDeclFolder(const char* folder, const char* extension, declType_t defaultType) = 0;
|
||||
|
||||
// Returns a checksum for all loaded decl text.
|
||||
virtual int GetChecksum( void ) const = 0;
|
||||
// Returns a checksum for all loaded decl text.
|
||||
virtual int GetChecksum(void) const = 0;
|
||||
|
||||
// Returns the number of decl types.
|
||||
virtual int GetNumDeclTypes( void ) const = 0;
|
||||
// Returns the number of decl types.
|
||||
virtual int GetNumDeclTypes(void) const = 0;
|
||||
|
||||
// Returns the type name for a decl type.
|
||||
virtual const char * GetDeclNameFromType( declType_t type ) const = 0;
|
||||
// Returns the type name for a decl type.
|
||||
virtual const char* GetDeclNameFromType(declType_t type) const = 0;
|
||||
|
||||
// Returns the decl type for a type name.
|
||||
virtual declType_t GetDeclTypeFromName( const char *typeName ) const = 0;
|
||||
// Returns the decl type for a type name.
|
||||
virtual declType_t GetDeclTypeFromName(const char* typeName) const = 0;
|
||||
|
||||
// If makeDefault is true, a default decl of appropriate type will be created
|
||||
// if an explicit one isn't found. If makeDefault is false, NULL will be returned
|
||||
// if the decl wasn't explcitly defined.
|
||||
virtual const idDecl * FindType( declType_t type, const char *name, bool makeDefault = true ) = 0;
|
||||
// If makeDefault is true, a default decl of appropriate type will be created
|
||||
// if an explicit one isn't found. If makeDefault is false, NULL will be returned
|
||||
// if the decl wasn't explcitly defined.
|
||||
virtual const idDecl* FindType(declType_t type, const char* name, bool makeDefault = true) = 0;
|
||||
|
||||
#ifdef QUAKE4
|
||||
// Quake 4 added decl caching, its not needed.
|
||||
virtual const idDecl* FindType(declType_t type, const char* name, bool makeDefault, bool noCaching) {
|
||||
virtual const idDecl* FindType(declType_t type, const char* name, bool makeDefault, bool noCaching) {
|
||||
return FindType(type, name, makeDefault);
|
||||
}
|
||||
#endif
|
||||
|
||||
virtual const idDecl* FindDeclWithoutParsing( declType_t type, const char *name, bool makeDefault = true ) = 0;
|
||||
virtual const idDecl* FindDeclWithoutParsing(declType_t type, const char* name, bool makeDefault = true) = 0;
|
||||
|
||||
virtual void ReloadFile( const char* filename, bool force ) = 0;
|
||||
virtual void ReloadFile(const char* filename, bool force) = 0;
|
||||
|
||||
// Returns the number of decls of the given type.
|
||||
virtual int GetNumDecls( declType_t type ) = 0;
|
||||
// Returns the number of decls of the given type.
|
||||
virtual int GetNumDecls(declType_t type) = 0;
|
||||
|
||||
// The complete lists of decls can be walked to populate editor browsers.
|
||||
// If forceParse is set false, you can get the decl to check name / filename / etc.
|
||||
// without causing it to parse the source and load media.
|
||||
virtual const idDecl * DeclByIndex( declType_t type, int index, bool forceParse = true ) = 0;
|
||||
// The complete lists of decls can be walked to populate editor browsers.
|
||||
// If forceParse is set false, you can get the decl to check name / filename / etc.
|
||||
// without causing it to parse the source and load media.
|
||||
virtual const idDecl* DeclByIndex(declType_t type, int index, bool forceParse = true) = 0;
|
||||
|
||||
// List and print decls.
|
||||
virtual void ListType( const idCmdArgs &args, declType_t type ) = 0;
|
||||
virtual void PrintType( const idCmdArgs &args, declType_t type ) = 0;
|
||||
// List and print decls.
|
||||
virtual void ListType(const idCmdArgs& args, declType_t type) = 0;
|
||||
virtual void PrintType(const idCmdArgs& args, declType_t type) = 0;
|
||||
|
||||
// Creates a new default decl of the given type with the given name in
|
||||
// the given file used by editors to create a new decls.
|
||||
virtual idDecl * CreateNewDecl( declType_t type, const char *name, const char *fileName ) = 0;
|
||||
// Creates a new default decl of the given type with the given name in
|
||||
// the given file used by editors to create a new decls.
|
||||
virtual idDecl* CreateNewDecl(declType_t type, const char* name, const char* fileName) = 0;
|
||||
|
||||
// BSM - Added for the material editors rename capabilities
|
||||
virtual bool RenameDecl( declType_t type, const char* oldName, const char* newName ) = 0;
|
||||
// BSM - Added for the material editors rename capabilities
|
||||
virtual bool RenameDecl(declType_t type, const char* oldName, const char* newName) = 0;
|
||||
|
||||
// When media files are loaded, a reference line can be printed at a
|
||||
// proper indentation if decl_show is set
|
||||
virtual void MediaPrint( const char *fmt, ... ) id_attribute((format(printf,2,3))) = 0;
|
||||
// When media files are loaded, a reference line can be printed at a
|
||||
// proper indentation if decl_show is set
|
||||
virtual void MediaPrint(const char* fmt, ...) id_attribute((format(printf, 2, 3))) = 0;
|
||||
|
||||
virtual void WritePrecacheCommands( idFile *f ) = 0;
|
||||
virtual void WritePrecacheCommands(idFile* f) = 0;
|
||||
|
||||
// Convenience functions for specific types.
|
||||
virtual const idMaterial * FindMaterial( const char *name, bool makeDefault = true ) = 0;
|
||||
virtual const idDeclSkin * FindSkin( const char *name, bool makeDefault = true ) = 0;
|
||||
virtual const idSoundShader * FindSound( const char *name, bool makeDefault = true ) = 0;
|
||||
#ifdef QUAKE4
|
||||
// Quake 4 guide/template support
|
||||
virtual void ParseGuides(void) = 0;
|
||||
virtual void ShutdownGuides(void) = 0;
|
||||
virtual bool EvaluateGuide(idStr& name, idLexer* src, idStr& definition) = 0;
|
||||
virtual bool EvaluateInlineGuide(idStr& name, idStr& definition) = 0;
|
||||
#endif
|
||||
|
||||
virtual const idMaterial * MaterialByIndex( int index, bool forceParse = true ) = 0;
|
||||
virtual const idDeclSkin * SkinByIndex( int index, bool forceParse = true ) = 0;
|
||||
virtual const idSoundShader * SoundByIndex( int index, bool forceParse = true ) = 0;
|
||||
// Convenience functions for specific types.
|
||||
virtual const idMaterial* FindMaterial(const char* name, bool makeDefault = true) = 0;
|
||||
virtual const idDeclSkin* FindSkin(const char* name, bool makeDefault = true) = 0;
|
||||
virtual const idSoundShader* FindSound(const char* name, bool makeDefault = true) = 0;
|
||||
|
||||
virtual const class idDeclTable* FindTable(const char* name, bool makeDefault = true) = 0;
|
||||
virtual const idMaterial* MaterialByIndex(int index, bool forceParse = true) = 0;
|
||||
virtual const idDeclSkin* SkinByIndex(int index, bool forceParse = true) = 0;
|
||||
virtual const idSoundShader* SoundByIndex(int index, bool forceParse = true) = 0;
|
||||
|
||||
virtual const class idDeclTable* FindTable(const char* name, bool makeDefault = true) = 0;
|
||||
|
||||
#ifdef QUAKE4
|
||||
virtual const class rvDeclMatType* FindMaterialType(const char* name, bool makeDefault = true) = 0;
|
||||
@@ -353,17 +389,17 @@ public:
|
||||
#endif
|
||||
};
|
||||
|
||||
extern idDeclManager * declManager;
|
||||
extern idDeclManager* declManager;
|
||||
|
||||
|
||||
template< declType_t type >
|
||||
ID_INLINE void idListDecls_f( const idCmdArgs &args ) {
|
||||
declManager->ListType( args, type );
|
||||
ID_INLINE void idListDecls_f(const idCmdArgs& args) {
|
||||
declManager->ListType(args, type);
|
||||
}
|
||||
|
||||
template< declType_t type >
|
||||
ID_INLINE void idPrintDecls_f( const idCmdArgs &args ) {
|
||||
declManager->PrintType( args, type );
|
||||
ID_INLINE void idPrintDecls_f(const idCmdArgs& args) {
|
||||
declManager->PrintType(args, type);
|
||||
}
|
||||
|
||||
#endif /* !__DECLMANAGER_H__ */
|
||||
|
||||
@@ -51,6 +51,8 @@ If you have questions concerning this license or the applicable additional terms
|
||||
#else
|
||||
#ifdef PREY
|
||||
#define BASE_GAMEDIR "preybase"
|
||||
#elif defined(QUAKE4)
|
||||
#define BASE_GAMEDIR "q4base"
|
||||
#else
|
||||
#define BASE_GAMEDIR "base"
|
||||
#endif
|
||||
|
||||
@@ -1815,7 +1815,7 @@ void idSessionLocal::ExecuteMapChange( bool noFadeWipe ) {
|
||||
|
||||
game->SetServerInfo( mapSpawnData.serverInfo );
|
||||
#ifdef QUAKE4
|
||||
game->InitFromNewMap(fullMapName + ".map", rw, sw, idAsyncNetwork::server.IsActive(), idAsyncNetwork::client.IsActive());
|
||||
game->InitFromNewMap(fullMapName + ".map", rw, idAsyncNetwork::server.IsActive(), idAsyncNetwork::client.IsActive(), 0);
|
||||
#else
|
||||
game->InitFromNewMap( fullMapName + ".map", rw, sw, idAsyncNetwork::server.IsActive(), idAsyncNetwork::client.IsActive(), Sys_Milliseconds() );
|
||||
#endif
|
||||
@@ -1823,7 +1823,7 @@ void idSessionLocal::ExecuteMapChange( bool noFadeWipe ) {
|
||||
} else {
|
||||
game->SetServerInfo( mapSpawnData.serverInfo );
|
||||
#ifdef QUAKE4
|
||||
game->InitFromNewMap(fullMapName + ".map", rw, sw, idAsyncNetwork::server.IsActive(), idAsyncNetwork::client.IsActive());
|
||||
game->InitFromNewMap(fullMapName + ".map", rw, idAsyncNetwork::server.IsActive(), idAsyncNetwork::client.IsActive(), 0);
|
||||
#else
|
||||
game->InitFromNewMap( fullMapName + ".map", rw, sw, idAsyncNetwork::server.IsActive(), idAsyncNetwork::client.IsActive(), Sys_Milliseconds() );
|
||||
#endif
|
||||
|
||||
+59
-29
@@ -537,6 +537,11 @@ idStr const Lexer::sCompiledFileSuffix( "c" );
|
||||
// RAVEN END
|
||||
#endif
|
||||
|
||||
/*
|
||||
================
|
||||
idLexer::CreatePunctuationTable
|
||||
================
|
||||
*/
|
||||
/*
|
||||
================
|
||||
idLexer::CreatePunctuationTable
|
||||
@@ -544,65 +549,90 @@ idLexer::CreatePunctuationTable
|
||||
*/
|
||||
void idLexer::CreatePunctuationTable( const punctuation_t *punctuations ) {
|
||||
int i, n, lastp;
|
||||
int numPunctuations;
|
||||
const punctuation_t *p, *newp;
|
||||
|
||||
//get memory for the table
|
||||
if ( punctuations == NULL ) {
|
||||
punctuations = default_punctuations;
|
||||
}
|
||||
|
||||
for ( numPunctuations = 0; punctuations[numPunctuations].p; numPunctuations++ ) {
|
||||
}
|
||||
|
||||
// get memory for the table
|
||||
if ( punctuations == default_punctuations ) {
|
||||
idLexer::punctuationtable = default_punctuationtable;
|
||||
idLexer::nextpunctuation = default_nextpunctuation;
|
||||
|
||||
if ( default_setup ) {
|
||||
return;
|
||||
}
|
||||
|
||||
default_setup = true;
|
||||
i = sizeof(default_punctuations) / sizeof(punctuation_t);
|
||||
}
|
||||
else {
|
||||
if ( !idLexer::punctuationtable || idLexer::punctuationtable == default_punctuationtable ) {
|
||||
#ifdef QUAKE4
|
||||
idLexer::punctuationtable = (int *) Mem_Alloc(256 * sizeof(int));
|
||||
|
||||
#ifdef QUAKE4
|
||||
i = numPunctuations;
|
||||
#else
|
||||
idLexer::punctuationtable = (int *) Mem_Alloc(256 * sizeof(int));
|
||||
i = sizeof( default_punctuations ) / sizeof( punctuation_t );
|
||||
#endif
|
||||
} else {
|
||||
if ( !idLexer::punctuationtable || idLexer::punctuationtable == default_punctuationtable ) {
|
||||
#ifdef QUAKE4
|
||||
idLexer::punctuationtable = (int *) Mem_Alloc( 256 * sizeof( int ) );
|
||||
#else
|
||||
idLexer::punctuationtable = (int *) Mem_Alloc( 256 * sizeof( int ) );
|
||||
#endif
|
||||
}
|
||||
|
||||
if ( idLexer::nextpunctuation && idLexer::nextpunctuation != default_nextpunctuation ) {
|
||||
Mem_Free( idLexer::nextpunctuation );
|
||||
}
|
||||
for (i = 0; punctuations[i].p; i++) {
|
||||
}
|
||||
#ifdef QUAKE4
|
||||
idLexer::nextpunctuation = (int *) Mem_Alloc(i * sizeof(int));
|
||||
|
||||
#ifdef QUAKE4
|
||||
idLexer::nextpunctuation = (int *) Mem_Alloc( numPunctuations * sizeof( int ) );
|
||||
#else
|
||||
idLexer::nextpunctuation = (int *) Mem_Alloc(i * sizeof(int));
|
||||
idLexer::nextpunctuation = (int *) Mem_Alloc( numPunctuations * sizeof( int ) );
|
||||
#endif
|
||||
|
||||
i = numPunctuations;
|
||||
}
|
||||
memset(idLexer::punctuationtable, 0xFF, 256 * sizeof(int));
|
||||
memset(idLexer::nextpunctuation, 0xFF, i * sizeof(int));
|
||||
//add the punctuations in the list to the punctuation table
|
||||
for (i = 0; punctuations[i].p; i++) {
|
||||
|
||||
memset( idLexer::punctuationtable, 0xFF, 256 * sizeof( int ) );
|
||||
memset( idLexer::nextpunctuation, 0xFF, i * sizeof( int ) );
|
||||
|
||||
// add the punctuations in the list to the punctuation table
|
||||
for ( i = 0; punctuations[i].p; i++ ) {
|
||||
newp = &punctuations[i];
|
||||
lastp = -1;
|
||||
//sort the punctuations in this table entry on length (longer punctuations first)
|
||||
for (n = idLexer::punctuationtable[(unsigned int) newp->p[0]]; n >= 0; n = idLexer::nextpunctuation[n] ) {
|
||||
|
||||
// char may be signed, so force the index to 0..255.
|
||||
const unsigned char firstChar = (unsigned char) newp->p[0];
|
||||
|
||||
// sort the punctuations in this table entry on length, longer punctuations first
|
||||
for ( n = idLexer::punctuationtable[firstChar]; n >= 0; n = idLexer::nextpunctuation[n] ) {
|
||||
p = &punctuations[n];
|
||||
if (strlen(p->p) < strlen(newp->p)) {
|
||||
|
||||
if ( strlen( p->p ) < strlen( newp->p ) ) {
|
||||
idLexer::nextpunctuation[i] = n;
|
||||
if (lastp >= 0) {
|
||||
|
||||
if ( lastp >= 0 ) {
|
||||
idLexer::nextpunctuation[lastp] = i;
|
||||
}
|
||||
else {
|
||||
idLexer::punctuationtable[(unsigned int) newp->p[0]] = i;
|
||||
} else {
|
||||
idLexer::punctuationtable[firstChar] = i;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
lastp = n;
|
||||
}
|
||||
if (n < 0) {
|
||||
|
||||
if ( n < 0 ) {
|
||||
idLexer::nextpunctuation[i] = -1;
|
||||
if (lastp >= 0) {
|
||||
|
||||
if ( lastp >= 0 ) {
|
||||
idLexer::nextpunctuation[lastp] = i;
|
||||
}
|
||||
else {
|
||||
idLexer::punctuationtable[(unsigned int) newp->p[0]] = i;
|
||||
} else {
|
||||
idLexer::punctuationtable[firstChar] = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,19 +29,6 @@ If you have questions concerning this license or the applicable additional terms
|
||||
#include "precompiled.h"
|
||||
#pragma hdrstop
|
||||
|
||||
#ifdef QUAKE4
|
||||
// TTimo - don't do anything funky if you're on a real OS ;-)
|
||||
#if defined(_WINDOWS) || defined(_XENON)
|
||||
#if ( !defined(ID_REDIRECT_NEWDELETE) && !defined(RV_UNIFIED_ALLOCATOR) ) || defined(_RV_MEM_SYS_SUPPORT)
|
||||
#define USE_STRING_DATA_ALLOCATOR
|
||||
#endif
|
||||
#endif
|
||||
#else
|
||||
#if !defined( ID_REDIRECT_NEWDELETE ) && !defined( MACOS_X )
|
||||
#define USE_STRING_DATA_ALLOCATOR
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef USE_STRING_DATA_ALLOCATOR
|
||||
static idDynamicBlockAlloc<char, 1 << 18, 128> stringDataAllocator;
|
||||
#endif
|
||||
|
||||
@@ -562,7 +562,21 @@ static bool R_ParseImageProgram_r( idLexer &src, byte **pic, int *width, int *he
|
||||
MatchAndAppendToken( src, ")" );
|
||||
return true;
|
||||
}
|
||||
#ifdef QUAKE4
|
||||
// jmarshall - quake 4 support
|
||||
if (!token.Icmp("downsize")) {
|
||||
MatchAndAppendToken(src, "(");
|
||||
R_ParseImageProgram_r(src, pic, width, height, timestamps, depth);
|
||||
|
||||
MatchAndAppendToken(src, ",");
|
||||
src.ReadToken(&token);
|
||||
AppendToken(token);
|
||||
|
||||
MatchAndAppendToken(src, ")");
|
||||
return true;
|
||||
}
|
||||
// jmarshall end
|
||||
#endif
|
||||
if ( !token.Icmp( "makeAlpha" ) ) {
|
||||
int i;
|
||||
|
||||
|
||||
@@ -235,7 +235,7 @@ void idMaterial::FreeData() {
|
||||
}
|
||||
#ifdef QUAKE4
|
||||
if (materialTypeArray != NULL) {
|
||||
Mem_Free(materialTypeArray);
|
||||
game->MT_FreeMaterialTypeArray(materialTypeArray);
|
||||
materialTypeArray = NULL;
|
||||
materialTypeArrayName = "";
|
||||
MTAWidth = 0;
|
||||
@@ -3025,7 +3025,28 @@ void idMaterial::ParseMaterial(idLexer& src) {
|
||||
src.ParseRestOfLine(renderBump);
|
||||
continue;
|
||||
}
|
||||
|
||||
#ifdef QUAKE4
|
||||
// Quake 4 material guide directives are metadata/preprocessor hints.
|
||||
// Treat them as no-op at runtime so shipped materials don't default.
|
||||
else if (!token.Icmp("inlineGuide") || !token.Icmp("guide")) {
|
||||
idToken guideName;
|
||||
if (src.ReadToken(&guideName)) {
|
||||
if (src.CheckTokenString("(")) {
|
||||
int parenDepth = 1;
|
||||
idToken guideToken;
|
||||
while (parenDepth > 0 && src.ReadToken(&guideToken)) {
|
||||
if (guideToken == "(") {
|
||||
parenDepth++;
|
||||
}
|
||||
else if (guideToken == ")") {
|
||||
parenDepth--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
else if (!token.Icmp("glowmap")) {
|
||||
str = R_ParsePastImageProgram(src);
|
||||
idStr::snPrintf(buffer, sizeof(buffer), "blend glowmap\nmap %s\n}\n", str);
|
||||
@@ -3241,12 +3262,7 @@ idMaterial::Parse
|
||||
Parses the current material definition and finds all necessary images.
|
||||
=========================
|
||||
*/
|
||||
#ifdef QUAKE4
|
||||
bool idMaterial::Parse(const char* text, const int textLength, bool noCaching) {
|
||||
(void)noCaching;
|
||||
#else
|
||||
bool idMaterial::Parse(const char* text, const int textLength) {
|
||||
#endif
|
||||
idLexer src;
|
||||
idToken token;
|
||||
mtrParsingData_t parsingData;
|
||||
|
||||
@@ -550,11 +550,7 @@ public:
|
||||
virtual size_t Size(void) const;
|
||||
virtual bool SetDefaultText(void);
|
||||
virtual const char* DefaultDefinition(void) const;
|
||||
#ifdef QUAKE4
|
||||
virtual bool Parse(const char* text, const int textLength, bool noCaching = false);
|
||||
#else
|
||||
virtual bool Parse(const char* text, const int textLength);
|
||||
#endif
|
||||
virtual void FreeData(void);
|
||||
virtual void Print(void) const;
|
||||
|
||||
|
||||
@@ -141,6 +141,13 @@ idRenderModel *idRenderWorldLocal::ParseModel( idLexer *src ) {
|
||||
if ( numSurfaces < 0 ) {
|
||||
src->Error( "R_ParseModel: bad numSurfaces" );
|
||||
}
|
||||
#ifdef QUAKE4
|
||||
// jmarshall - quake 4 proc format
|
||||
if (!src->PeekTokenString("{") && !src->PeekTokenString("}")) {
|
||||
int sky = src->ParseInt();
|
||||
}
|
||||
// jmarshall end
|
||||
#endif
|
||||
|
||||
for ( i = 0 ; i < numSurfaces ; i++ ) {
|
||||
src->ExpectTokenString( "{" );
|
||||
@@ -159,6 +166,36 @@ idRenderModel *idRenderWorldLocal::ParseModel( idLexer *src ) {
|
||||
|
||||
R_AllocStaticTriSurfVerts( tri, tri->numVerts );
|
||||
for ( j = 0 ; j < tri->numVerts ; j++ ) {
|
||||
#ifdef QUAKE4
|
||||
// jmarshall - quake 4 proc format
|
||||
float vec[12];
|
||||
const int numFloats = src->Parse1DMatrixOpenEnded( 12, vec );
|
||||
if ( numFloats != 8 && numFloats != 12 ) {
|
||||
src->Error( "R_ParseModel: bad vertex read" );
|
||||
}
|
||||
|
||||
tri->verts[j].xyz[0] = vec[0];
|
||||
tri->verts[j].xyz[1] = vec[1];
|
||||
tri->verts[j].xyz[2] = vec[2];
|
||||
tri->verts[j].st[0] = vec[3];
|
||||
tri->verts[j].st[1] = vec[4];
|
||||
tri->verts[j].normal[0] = vec[5];
|
||||
tri->verts[j].normal[1] = vec[6];
|
||||
tri->verts[j].normal[2] = vec[7];
|
||||
|
||||
if ( numFloats == 12 ) {
|
||||
tri->verts[j].color[0] = idMath::Ftob( vec[8] );
|
||||
tri->verts[j].color[1] = idMath::Ftob( vec[9] );
|
||||
tri->verts[j].color[2] = idMath::Ftob( vec[10] );
|
||||
tri->verts[j].color[3] = idMath::Ftob( vec[11] );
|
||||
} else {
|
||||
tri->verts[j].color[0] = 0;
|
||||
tri->verts[j].color[1] = 0;
|
||||
tri->verts[j].color[2] = 0;
|
||||
tri->verts[j].color[3] = 255;
|
||||
}
|
||||
// jmarshall end
|
||||
#else
|
||||
float vec[8];
|
||||
|
||||
src->Parse1DMatrix( 8, vec );
|
||||
@@ -171,6 +208,7 @@ idRenderModel *idRenderWorldLocal::ParseModel( idLexer *src ) {
|
||||
tri->verts[j].normal[0] = vec[5];
|
||||
tri->verts[j].normal[1] = vec[6];
|
||||
tri->verts[j].normal[2] = vec[7];
|
||||
#endif
|
||||
}
|
||||
|
||||
R_AllocStaticTriSurfIndexes( tri, tri->numIndexes );
|
||||
@@ -544,7 +582,18 @@ bool idRenderWorldLocal::InitFromMap( const char *name ) {
|
||||
delete src;
|
||||
return false;
|
||||
}
|
||||
#ifdef QUAKE4
|
||||
// jmarshall: quake 4 proc format
|
||||
if (!src->ReadToken(&token)) {
|
||||
common->Printf("idRenderWorldLocal::InitFromMap: bad version '%s' instead of '%s'\n", token.c_str(), PROC_FILEVERSION);
|
||||
delete src;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Map CRC, we aren't going to use it.
|
||||
src->ReadToken(&token);
|
||||
// jmarshall end
|
||||
#endif
|
||||
// parse the file
|
||||
while ( 1 ) {
|
||||
if ( !src->ReadToken( &token ) ) {
|
||||
|
||||
+225
-142
@@ -268,7 +268,217 @@ RegisterFont
|
||||
Loads 3 point sizes, 12, 24, and 48
|
||||
============
|
||||
*/
|
||||
|
||||
bool idRenderSystemLocal::RegisterFont(const char* fontName, fontInfoEx_t& font) {
|
||||
#ifdef QUAKE4
|
||||
|
||||
void* faceData;
|
||||
ID_TIME_T ftime;
|
||||
int fontCount;
|
||||
int found;
|
||||
char fontDatName[1024];
|
||||
char materialName[1024];
|
||||
|
||||
memset(&font, 0, sizeof(font));
|
||||
|
||||
found = 0;
|
||||
|
||||
for (fontCount = 0; fontCount < 3; fontCount++) {
|
||||
int pointSize;
|
||||
fontInfo_t* outFont;
|
||||
|
||||
if (fontCount == 0) {
|
||||
pointSize = 12;
|
||||
outFont = &font.fontInfoSmall;
|
||||
}
|
||||
else if (fontCount == 1) {
|
||||
pointSize = 24;
|
||||
outFont = &font.fontInfoMedium;
|
||||
}
|
||||
else {
|
||||
pointSize = 48;
|
||||
outFont = &font.fontInfoLarge;
|
||||
}
|
||||
|
||||
idStr::snPrintf(fontDatName, sizeof(fontDatName), "%s_%i.fontdat", fontName, pointSize);
|
||||
#define FILESIZE_q4FontInfo_t 9236
|
||||
if (fileSystem->ReadFile(fontDatName, NULL, &ftime) != FILESIZE_q4FontInfo_t) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (fileSystem->ReadFile(fontDatName, &faceData, &ftime) <= 0 || faceData == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
fdOffset = 0;
|
||||
fdFile = reinterpret_cast<byte*>(faceData);
|
||||
|
||||
found |= 1 << fontCount;
|
||||
|
||||
idStr::Copynz(outFont->name, fontDatName, sizeof(outFont->name));
|
||||
|
||||
int mw = 0;
|
||||
int mh = 0;
|
||||
|
||||
for (int i = 0; i < GLYPHS_PER_FONT; i++) {
|
||||
glyphInfo_t& glyph = outFont->glyphs[i];
|
||||
|
||||
/*
|
||||
Quake 4 disk glyph order:
|
||||
float width;
|
||||
float height;
|
||||
float horiAdvance;
|
||||
float horiBearingX;
|
||||
float horiBearingY;
|
||||
float s1;
|
||||
float t1;
|
||||
float s2;
|
||||
float t2;
|
||||
|
||||
Doom 3 glyphInfo_t is not the same struct, so map it.
|
||||
*/
|
||||
const float q4Width = readFloat();
|
||||
const float q4Height = readFloat();
|
||||
const float q4HoriAdvance = readFloat();
|
||||
const float q4HoriBearingX = readFloat();
|
||||
const float q4HoriBearingY = readFloat();
|
||||
const float q4S1 = readFloat();
|
||||
const float q4T1 = readFloat();
|
||||
const float q4S2 = readFloat();
|
||||
const float q4T2 = readFloat();
|
||||
|
||||
glyph.height = (int)q4Height;
|
||||
glyph.top = (int)q4HoriBearingY;
|
||||
glyph.bottom = (int)(q4HoriBearingY - q4Height);
|
||||
glyph.pitch = (int)q4Width;
|
||||
glyph.xSkip = (int)q4HoriAdvance;
|
||||
glyph.imageWidth = (int)q4Width;
|
||||
glyph.imageHeight = (int)q4Height;
|
||||
|
||||
glyph.s = q4S1;
|
||||
glyph.t = q4T1;
|
||||
glyph.s2 = q4S2;
|
||||
glyph.t2 = q4T2;
|
||||
|
||||
glyph.glyph = NULL;
|
||||
glyph.shaderName[0] = '\0';
|
||||
|
||||
if (mw < glyph.xSkip) {
|
||||
mw = glyph.xSkip;
|
||||
}
|
||||
if (mh < glyph.height) {
|
||||
mh = glyph.height;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Quake 4 stores these after the glyph array:
|
||||
pointSize, fontHeight, ascender, descender, material pointer
|
||||
|
||||
Doom 3's fontInfo_t does not have those fields, so consume them.
|
||||
*/
|
||||
const float q4PointSize = readFloat();
|
||||
const float q4FontHeight = readFloat();
|
||||
const float q4Ascender = readFloat();
|
||||
const float q4Descender = readFloat();
|
||||
|
||||
// consume the saved material pointer / padding from the .fontdat
|
||||
readInt();
|
||||
|
||||
outFont->glyphScale = 48.0f / pointSize;
|
||||
|
||||
fileSystem->FreeFile(faceData);
|
||||
faceData = NULL;
|
||||
|
||||
/*
|
||||
The Quake 4 atlas is the .tga beside the .fontdat:
|
||||
fonts/marine_12.fontdat
|
||||
fonts/marine_12.tga
|
||||
|
||||
Doom 3 stores material per glyph, so assign the same atlas material
|
||||
to every glyph.
|
||||
*/
|
||||
idStr::snPrintf(materialName, sizeof(materialName), "%s_%i.tga", fontName, pointSize);
|
||||
|
||||
for (int i = 0; i < GLYPHS_PER_FONT; i++) {
|
||||
outFont->glyphs[i].glyph = declManager->FindMaterial(materialName);
|
||||
if (outFont->glyphs[i].glyph != NULL) {
|
||||
outFont->glyphs[i].glyph->SetSort(SS_GUI);
|
||||
}
|
||||
idStr::Copynz(outFont->glyphs[i].shaderName, materialName, sizeof(outFont->glyphs[i].shaderName));
|
||||
}
|
||||
|
||||
if (fontCount == 0) {
|
||||
font.maxWidthSmall = mw;
|
||||
font.maxHeightSmall = mh;
|
||||
}
|
||||
else if (fontCount == 1) {
|
||||
font.maxWidthMedium = mw;
|
||||
font.maxHeightMedium = mh;
|
||||
}
|
||||
else {
|
||||
font.maxWidthLarge = mw;
|
||||
font.maxHeightLarge = mh;
|
||||
}
|
||||
}
|
||||
|
||||
switch (found) {
|
||||
case 1:
|
||||
memcpy(&font.fontInfoMedium, &font.fontInfoSmall, sizeof(font.fontInfoMedium));
|
||||
font.maxWidthMedium = font.maxWidthSmall;
|
||||
font.maxHeightMedium = font.maxHeightSmall;
|
||||
|
||||
memcpy(&font.fontInfoLarge, &font.fontInfoSmall, sizeof(font.fontInfoLarge));
|
||||
font.maxWidthLarge = font.maxWidthSmall;
|
||||
font.maxHeightLarge = font.maxHeightSmall;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
memcpy(&font.fontInfoSmall, &font.fontInfoMedium, sizeof(font.fontInfoSmall));
|
||||
font.maxWidthSmall = font.maxWidthMedium;
|
||||
font.maxHeightSmall = font.maxHeightMedium;
|
||||
|
||||
memcpy(&font.fontInfoLarge, &font.fontInfoMedium, sizeof(font.fontInfoLarge));
|
||||
font.maxWidthLarge = font.maxWidthMedium;
|
||||
font.maxHeightLarge = font.maxHeightMedium;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
memcpy(&font.fontInfoLarge, &font.fontInfoMedium, sizeof(font.fontInfoLarge));
|
||||
font.maxWidthLarge = font.maxWidthMedium;
|
||||
font.maxHeightLarge = font.maxHeightMedium;
|
||||
break;
|
||||
|
||||
case 4:
|
||||
memcpy(&font.fontInfoSmall, &font.fontInfoLarge, sizeof(font.fontInfoSmall));
|
||||
font.maxWidthSmall = font.maxWidthLarge;
|
||||
font.maxHeightSmall = font.maxHeightLarge;
|
||||
|
||||
memcpy(&font.fontInfoMedium, &font.fontInfoLarge, sizeof(font.fontInfoMedium));
|
||||
font.maxWidthMedium = font.maxWidthLarge;
|
||||
font.maxHeightMedium = font.maxHeightLarge;
|
||||
break;
|
||||
|
||||
case 5:
|
||||
memcpy(&font.fontInfoMedium, &font.fontInfoLarge, sizeof(font.fontInfoMedium));
|
||||
font.maxWidthMedium = font.maxWidthLarge;
|
||||
font.maxHeightMedium = font.maxHeightLarge;
|
||||
break;
|
||||
|
||||
case 6:
|
||||
memcpy(&font.fontInfoSmall, &font.fontInfoMedium, sizeof(font.fontInfoSmall));
|
||||
font.maxWidthSmall = font.maxWidthMedium;
|
||||
font.maxHeightSmall = font.maxHeightMedium;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return found != 0;
|
||||
|
||||
#else
|
||||
|
||||
#ifdef BUILD_FREETYPE
|
||||
FT_Face face;
|
||||
int j, k, xOut, yOut, lastStart, imageNumber;
|
||||
@@ -279,27 +489,14 @@ bool idRenderSystemLocal::RegisterFont(const char* fontName, fontInfoEx_t& font)
|
||||
idMaterial* h;
|
||||
float max;
|
||||
#endif
|
||||
|
||||
void* faceData;
|
||||
ID_TIME_T ftime;
|
||||
int i, len, fontCount;
|
||||
char name[1024];
|
||||
|
||||
int pointSize = 12;
|
||||
/*
|
||||
if ( registeredFontCount >= MAX_FONTS ) {
|
||||
common->Warning( "RegisterFont: Too many fonts registered already." );
|
||||
return false;
|
||||
}
|
||||
|
||||
int pointSize = 12;
|
||||
idStr::snPrintf( name, sizeof(name), "%s/fontImage_%i.dat", fontName, pointSize );
|
||||
for ( i = 0; i < registeredFontCount; i++ ) {
|
||||
if ( idStr::Icmp(name, registeredFont[i].fontInfoSmall.name) == 0 ) {
|
||||
memcpy( &font, ®isteredFont[i], sizeof( fontInfoEx_t ) );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
*/
|
||||
assert(sizeof(float) == 4 && "if this is false, readFloat() won't work");
|
||||
|
||||
memset(&font, 0, sizeof(font));
|
||||
@@ -315,8 +512,8 @@ bool idRenderSystemLocal::RegisterFont(const char* fontName, fontInfoEx_t& font)
|
||||
else {
|
||||
pointSize = 48;
|
||||
}
|
||||
// we also need to adjust the scale based on point size relative to 48 points as the ui scaling is based on a 48 point font
|
||||
float glyphScale = 1.0f; // change the scale to be relative to 1 based on 72 dpi ( so dpi of 144 means a scale of .5 )
|
||||
|
||||
float glyphScale = 1.0f;
|
||||
glyphScale *= 48.0f / pointSize;
|
||||
|
||||
idStr::snPrintf(name, sizeof(name), "%s/fontImage_%i.dat", fontName, pointSize);
|
||||
@@ -341,8 +538,10 @@ bool idRenderSystemLocal::RegisterFont(const char* fontName, fontInfoEx_t& font)
|
||||
}
|
||||
|
||||
fileSystem->ReadFile(name, &faceData, &ftime);
|
||||
|
||||
fdOffset = 0;
|
||||
fdFile = reinterpret_cast<unsigned char*>(faceData);
|
||||
|
||||
for (i = 0; i < GLYPHS_PER_FONT; i++) {
|
||||
outFont->glyphs[i].height = readInt();
|
||||
outFont->glyphs[i].top = readInt();
|
||||
@@ -355,19 +554,24 @@ bool idRenderSystemLocal::RegisterFont(const char* fontName, fontInfoEx_t& font)
|
||||
outFont->glyphs[i].t = readFloat();
|
||||
outFont->glyphs[i].s2 = readFloat();
|
||||
outFont->glyphs[i].t2 = readFloat();
|
||||
/* font.glyphs[i].glyph = */ readInt();
|
||||
//FIXME: the +6, -6 skips the embedded fonts/
|
||||
|
||||
readInt();
|
||||
|
||||
memcpy(outFont->glyphs[i].shaderName, &fdFile[fdOffset + 6], 32 - 6);
|
||||
fdOffset += 32;
|
||||
}
|
||||
|
||||
outFont->glyphScale = readFloat();
|
||||
|
||||
int mw = 0;
|
||||
int mh = 0;
|
||||
|
||||
for (i = GLYPH_START; i < GLYPH_END; i++) {
|
||||
idStr::snPrintf(name, sizeof(name), "%s/%s", fontName, outFont->glyphs[i].shaderName);
|
||||
|
||||
outFont->glyphs[i].glyph = declManager->FindMaterial(name);
|
||||
outFont->glyphs[i].glyph->SetSort(SS_GUI);
|
||||
|
||||
if (mh < outFont->glyphs[i].height) {
|
||||
mh = outFont->glyphs[i].height;
|
||||
}
|
||||
@@ -375,6 +579,7 @@ bool idRenderSystemLocal::RegisterFont(const char* fontName, fontInfoEx_t& font)
|
||||
mw = outFont->glyphs[i].xSkip;
|
||||
}
|
||||
}
|
||||
|
||||
if (fontCount == 0) {
|
||||
font.maxWidthSmall = mw;
|
||||
font.maxHeightSmall = mh;
|
||||
@@ -387,135 +592,13 @@ bool idRenderSystemLocal::RegisterFont(const char* fontName, fontInfoEx_t& font)
|
||||
font.maxWidthLarge = mw;
|
||||
font.maxHeightLarge = mh;
|
||||
}
|
||||
|
||||
fileSystem->FreeFile(faceData);
|
||||
}
|
||||
|
||||
//memcpy( ®isteredFont[registeredFontCount++], &font, sizeof( fontInfoEx_t ) );
|
||||
|
||||
return true;
|
||||
|
||||
#ifndef BUILD_FREETYPE
|
||||
common->Warning("RegisterFont: couldn't load FreeType code %s", name);
|
||||
#else
|
||||
|
||||
if (ftLibrary == NULL) {
|
||||
common->Warning("RegisterFont: FreeType not initialized.");
|
||||
return;
|
||||
}
|
||||
|
||||
len = fileSystem->ReadFile(fontName, &faceData, &ftime);
|
||||
if (len <= 0) {
|
||||
common->Warning("RegisterFont: Unable to read font file");
|
||||
return;
|
||||
}
|
||||
|
||||
// allocate on the stack first in case we fail
|
||||
if (FT_New_Memory_Face(ftLibrary, faceData, len, 0, &face)) {
|
||||
common->Warning("RegisterFont: FreeType2, unable to allocate new face.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (FT_Set_Char_Size(face, pointSize << 6, pointSize << 6, dpi, dpi)) {
|
||||
common->Warning("RegisterFont: FreeType2, Unable to set face char size.");
|
||||
return;
|
||||
}
|
||||
|
||||
// font = registeredFonts[registeredFontCount++];
|
||||
|
||||
// make a 256x256 image buffer, once it is full, register it, clean it and keep going
|
||||
// until all glyphs are rendered
|
||||
|
||||
out = Mem_Alloc(1024 * 1024);
|
||||
if (out == NULL) {
|
||||
common->Warning("RegisterFont: Mem_Alloc failure during output image creation.");
|
||||
return;
|
||||
}
|
||||
memset(out, 0, 1024 * 1024);
|
||||
|
||||
maxHeight = 0;
|
||||
|
||||
for (i = GLYPH_START; i < GLYPH_END; i++) {
|
||||
glyph = RE_ConstructGlyphInfo(out, &xOut, &yOut, &maxHeight, face, (unsigned char)i, qtrue);
|
||||
}
|
||||
|
||||
xOut = 0;
|
||||
yOut = 0;
|
||||
i = GLYPH_START;
|
||||
lastStart = i;
|
||||
imageNumber = 0;
|
||||
|
||||
while (i <= GLYPH_END) {
|
||||
|
||||
glyph = RE_ConstructGlyphInfo(out, &xOut, &yOut, &maxHeight, face, (unsigned char)i, qfalse);
|
||||
|
||||
if (xOut == -1 || yOut == -1 || i == GLYPH_END) {
|
||||
// ran out of room
|
||||
// we need to create an image from the bitmap, set all the handles in the glyphs to this point
|
||||
//
|
||||
|
||||
scaledSize = 256 * 256;
|
||||
newSize = scaledSize * 4;
|
||||
imageBuff = Mem_Alloc(newSize);
|
||||
left = 0;
|
||||
max = 0;
|
||||
satLevels = 255;
|
||||
for (k = 0; k < (scaledSize); k++) {
|
||||
if (max < out[k]) {
|
||||
max = out[k];
|
||||
}
|
||||
}
|
||||
|
||||
if (max > 0) {
|
||||
max = 255 / max;
|
||||
}
|
||||
|
||||
for (k = 0; k < (scaledSize); k++) {
|
||||
imageBuff[left++] = 255;
|
||||
imageBuff[left++] = 255;
|
||||
imageBuff[left++] = 255;
|
||||
imageBuff[left++] = ((float)out[k] * max);
|
||||
}
|
||||
|
||||
idStr::snprintf(name, sizeof(name), "fonts/fontImage_%i_%i.tga", imageNumber++, pointSize);
|
||||
if (r_saveFontData->integer) {
|
||||
R_WriteTGA(name, imageBuff, 256, 256);
|
||||
}
|
||||
|
||||
//idStr::snprintf( name, sizeof(name), "fonts/fontImage_%i_%i", imageNumber++, pointSize );
|
||||
image = R_CreateImage(name, imageBuff, 256, 256, qfalse, qfalse, GL_CLAMP);
|
||||
h = RE_RegisterShaderFromImage(name, LIGHTMAP_2D, image, qfalse);
|
||||
for (j = lastStart; j < i; j++) {
|
||||
font.glyphs[j].glyph = h;
|
||||
idStr::Copynz(font.glyphs[j].shaderName, name, sizeof(font.glyphs[j].shaderName));
|
||||
}
|
||||
lastStart = i;
|
||||
memset(out, 0, 1024 * 1024);
|
||||
xOut = 0;
|
||||
yOut = 0;
|
||||
Mem_Free(imageBuff);
|
||||
i++;
|
||||
}
|
||||
else {
|
||||
memcpy(&font.glyphs[i], glyph, sizeof(glyphInfo_t));
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
registeredFont[registeredFontCount].glyphScale = glyphScale;
|
||||
font.glyphScale = glyphScale;
|
||||
memcpy(®isteredFont[registeredFontCount++], &font, sizeof(fontInfo_t));
|
||||
|
||||
if (r_saveFontData->integer) {
|
||||
common->Warning("FIXME: font saving doesnt respect alignment!");
|
||||
fileSystem->WriteFile(va("fonts/fontImage_%i.dat", pointSize), &font, sizeof(fontInfo_t));
|
||||
}
|
||||
|
||||
Mem_Free(out);
|
||||
|
||||
fileSystem->FreeFile(faceData);
|
||||
#endif
|
||||
return true;
|
||||
#endif // QUAKE4
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -1388,7 +1388,7 @@ idSoundWorldLocal::EmitterForIndex
|
||||
===================
|
||||
*/
|
||||
idSoundEmitter *idSoundWorldLocal::EmitterForIndex( int index ) {
|
||||
if ( index == 0 ) {
|
||||
if ( index <= 0 ) {
|
||||
return NULL;
|
||||
}
|
||||
if ( index >= emitters.Num() ) {
|
||||
|
||||
@@ -1517,6 +1517,11 @@ bool idAASFileLocal::Load( const idStr &fileName, unsigned int mapFileCRC ) {
|
||||
}
|
||||
}
|
||||
|
||||
if (nodes.Num() <= 0) {
|
||||
src.Error("idAASFileLocal::Load: No Nodes!");
|
||||
return false;
|
||||
}
|
||||
|
||||
FinishAreas();
|
||||
|
||||
depth = MaxTreeDepth();
|
||||
|
||||
@@ -453,6 +453,16 @@ This is the same as in idListWindow
|
||||
*/
|
||||
void idEditWindow::InitScroller( bool horizontal )
|
||||
{
|
||||
#ifdef QUAKE4
|
||||
const char* thumbImage = "gfx/guis/scrollbar_thumb";
|
||||
const char* barImage = "gfx/guis/scrollbarv";
|
||||
const char* scrollerName = "_scrollerWinV";
|
||||
|
||||
if (horizontal) {
|
||||
barImage = "gfx/guis/scrollbarh";
|
||||
scrollerName = "_scrollerWinH";
|
||||
}
|
||||
#else
|
||||
const char *thumbImage = "guis/assets/scrollbar_thumb.tga";
|
||||
const char *barImage = "guis/assets/scrollbarv.tga";
|
||||
const char *scrollerName = "_scrollerWinV";
|
||||
@@ -461,7 +471,7 @@ void idEditWindow::InitScroller( bool horizontal )
|
||||
barImage = "guis/assets/scrollbarh.tga";
|
||||
scrollerName = "_scrollerWinH";
|
||||
}
|
||||
|
||||
#endif
|
||||
const idMaterial *mat = declManager->FindMaterial( barImage );
|
||||
mat->SetSort( SS_GUI );
|
||||
sizeBias = mat->GetImageWidth();
|
||||
|
||||
+583
-255
File diff suppressed because it is too large
Load Diff
+31
-31
@@ -1,28 +1,25 @@
|
||||
/*
|
||||
===========================================================================
|
||||
|
||||
IceTech GPL Source Code
|
||||
Copyright (C) 2026 Justin Marshall
|
||||
Doom 3 GPL Source Code
|
||||
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the IceTech GPL Source Code (?IceTech Source Code?).
|
||||
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").
|
||||
|
||||
IceTech Source Code is free software: you can redistribute it and/or modify
|
||||
Doom 3 Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
IceTech Source Code is distributed in the hope that it will be useful,
|
||||
Doom 3 Source Code 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 IceTech Source Code. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
In addition, the IceTech Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the IceTech Source Code. If not, please request a copy in writing from id Software at the address below.
|
||||
|
||||
If you have questions concerning this license or the applicable additional terms, you may contact in writing Justin Marshall, justinmarshall20@gmail.com
|
||||
along with Doom 3 Source Code. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
In addition, the Doom 3 Source Code is also subject to certain additional terms.
|
||||
===========================================================================
|
||||
*/
|
||||
#ifndef __GUISCRIPT_H
|
||||
@@ -50,56 +47,59 @@ public:
|
||||
idGuiScript();
|
||||
~idGuiScript();
|
||||
|
||||
bool Parse(idParser *src);
|
||||
void Execute(idWindow *win) {
|
||||
bool Parse(idParser* src);
|
||||
void Execute(idWindow* win) {
|
||||
if (handler) {
|
||||
handler(win, &parms);
|
||||
}
|
||||
}
|
||||
void FixupParms(idWindow *win);
|
||||
void FixupParms(idWindow* win);
|
||||
|
||||
size_t Size() {
|
||||
int sz = sizeof(*this);
|
||||
size_t sz = sizeof(*this);
|
||||
for (int i = 0; i < parms.Num(); i++) {
|
||||
sz += parms[i].var->Size();
|
||||
}
|
||||
return sz;
|
||||
}
|
||||
|
||||
void WriteToSaveGame( idFile *savefile );
|
||||
void ReadFromSaveGame( idFile *savefile );
|
||||
void WriteToSaveGame(idFile* savefile);
|
||||
void ReadFromSaveGame(idFile* savefile);
|
||||
|
||||
protected:
|
||||
int conditionReg;
|
||||
idGuiScriptList *ifList;
|
||||
idGuiScriptList *elseList;
|
||||
idGuiScriptList* ifList;
|
||||
idGuiScriptList* elseList;
|
||||
idList<idGSWinVar> parms;
|
||||
void (*handler) (idWindow *window, idList<idGSWinVar> *src);
|
||||
|
||||
void (*handler)(idWindow* window, idList<idGSWinVar>* src);
|
||||
};
|
||||
|
||||
|
||||
class idGuiScriptList {
|
||||
idList<idGuiScript*> list;
|
||||
|
||||
public:
|
||||
idGuiScriptList() { list.SetGranularity( 4 ); };
|
||||
~idGuiScriptList() { list.DeleteContents(true); };
|
||||
void Execute(idWindow *win);
|
||||
idGuiScriptList() { list.SetGranularity(4); }
|
||||
~idGuiScriptList() { list.DeleteContents(true); }
|
||||
|
||||
void Execute(idWindow* win);
|
||||
void Append(idGuiScript* gs) {
|
||||
list.Append(gs);
|
||||
}
|
||||
|
||||
size_t Size() {
|
||||
int sz = sizeof(*this);
|
||||
size_t sz = sizeof(*this);
|
||||
for (int i = 0; i < list.Num(); i++) {
|
||||
sz += list[i]->Size();
|
||||
}
|
||||
return sz;
|
||||
}
|
||||
void FixupParms(idWindow *win);
|
||||
void ReadFromDemoFile( class idDemoFile *f ) {};
|
||||
void WriteToDemoFile( class idDemoFile *f ) {};
|
||||
|
||||
void WriteToSaveGame( idFile *savefile );
|
||||
void ReadFromSaveGame( idFile *savefile );
|
||||
void FixupParms(idWindow* win);
|
||||
void ReadFromDemoFile(class idDemoFile* f) {}
|
||||
void WriteToDemoFile(class idDemoFile* f) {}
|
||||
|
||||
void WriteToSaveGame(idFile* savefile);
|
||||
void ReadFromSaveGame(idFile* savefile);
|
||||
};
|
||||
|
||||
#endif // __GUISCRIPT_H
|
||||
#endif // __GUISCRIPT_H
|
||||
+1659
-1043
File diff suppressed because it is too large
Load Diff
+281
-143
@@ -1,27 +1,27 @@
|
||||
/*
|
||||
===========================================================================
|
||||
|
||||
IceTech GPL Source Code
|
||||
Copyright (C) 2026 Justin Marshall
|
||||
Doom 3 GPL Source Code
|
||||
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the IceTech GPL Source Code (?IceTech Source Code?).
|
||||
This file is part of the Doom 3 GPL Source Code (?Doom 3 Source Code?).
|
||||
|
||||
IceTech Source Code is free software: you can redistribute it and/or modify
|
||||
Doom 3 Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
IceTech Source Code is distributed in the hope that it will be useful,
|
||||
Doom 3 Source Code 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 IceTech Source Code. If not, see <http://www.gnu.org/licenses/>.
|
||||
along with Doom 3 Source Code. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
In addition, the IceTech Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the IceTech Source Code. If not, please request a copy in writing from id Software at the address below.
|
||||
In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below.
|
||||
|
||||
If you have questions concerning this license or the applicable additional terms, you may contact in writing Justin Marshall, justinmarshall20@gmail.com
|
||||
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
|
||||
|
||||
===========================================================================
|
||||
*/
|
||||
@@ -34,33 +34,39 @@ If you have questions concerning this license or the applicable additional terms
|
||||
#include "GuiScript.h"
|
||||
#include "SimpleWindow.h"
|
||||
|
||||
const int WIN_CHILD = 0x00000001;
|
||||
const int WIN_CAPTION = 0x00000002;
|
||||
const int WIN_BORDER = 0x00000004;
|
||||
const int WIN_SIZABLE = 0x00000008;
|
||||
const int WIN_MOVABLE = 0x00000010;
|
||||
const int WIN_FOCUS = 0x00000020;
|
||||
const int WIN_CAPTURE = 0x00000040;
|
||||
const int WIN_HCENTER = 0x00000080;
|
||||
const int WIN_VCENTER = 0x00000100;
|
||||
const int WIN_MODAL = 0x00000200;
|
||||
const int WIN_INTRANSITION = 0x00000400;
|
||||
const int WIN_CANFOCUS = 0x00000800;
|
||||
const int WIN_SELECTED = 0x00001000;
|
||||
const int WIN_TRANSFORM = 0x00002000;
|
||||
const int WIN_HOLDCAPTURE = 0x00004000;
|
||||
const int WIN_NOWRAP = 0x00008000;
|
||||
const int WIN_NOCLIP = 0x00010000;
|
||||
const int WIN_INVERTRECT = 0x00020000;
|
||||
const int WIN_NATURALMAT = 0x00040000;
|
||||
const int WIN_NOCURSOR = 0x00080000;
|
||||
const int WIN_MENUGUI = 0x00100000;
|
||||
const int WIN_ACTIVE = 0x00200000;
|
||||
const int WIN_SHOWCOORDS = 0x00400000;
|
||||
const int WIN_SHOWTIME = 0x00800000;
|
||||
const int WIN_WANTENTER = 0x01000000;
|
||||
const int WIN_CHILD = 0x00000001;
|
||||
const int WIN_CAPTION = 0x00000002;
|
||||
const int WIN_BORDER = 0x00000004;
|
||||
const int WIN_SIZABLE = 0x00000008;
|
||||
const int WIN_MOVABLE = 0x00000010;
|
||||
const int WIN_FOCUS = 0x00000020;
|
||||
const int WIN_CAPTURE = 0x00000040;
|
||||
const int WIN_HCENTER = 0x00000080;
|
||||
const int WIN_VCENTER = 0x00000100;
|
||||
const int WIN_MODAL = 0x00000200;
|
||||
const int WIN_INTRANSITION = 0x00000400;
|
||||
const int WIN_CANFOCUS = 0x00000800;
|
||||
const int WIN_SELECTED = 0x00001000;
|
||||
const int WIN_TRANSFORM = 0x00002000;
|
||||
const int WIN_HOLDCAPTURE = 0x00004000;
|
||||
const int WIN_NOWRAP = 0x00008000;
|
||||
const int WIN_NOCLIP = 0x00010000;
|
||||
const int WIN_INVERTRECT = 0x00020000;
|
||||
const int WIN_NATURALMAT = 0x00040000;
|
||||
const int WIN_NOCURSOR = 0x00080000;
|
||||
const int WIN_MENUGUI = 0x00100000;
|
||||
const int WIN_ACTIVE = 0x00200000;
|
||||
const int WIN_SHOWCOORDS = 0x00400000;
|
||||
const int WIN_SHOWTIME = 0x00800000;
|
||||
const int WIN_WANTENTER = 0x01000000;
|
||||
#ifdef QUAKE4
|
||||
const int WIN_ALWAYSTHINK = 0x08000000;
|
||||
#endif
|
||||
|
||||
const int WIN_DESKTOP = 0x10000000;
|
||||
const int WIN_DESKTOP = 0x10000000;
|
||||
#ifdef QUAKE4
|
||||
const int WIN_CHATWINDOW = 0x20000000;
|
||||
#endif
|
||||
|
||||
const char CAPTION_HEIGHT[] = "16.0";
|
||||
const char SCROLLER_SIZE[] = "16.0";
|
||||
@@ -95,6 +101,9 @@ typedef enum {
|
||||
WOP_TYPE_VARI,
|
||||
WOP_TYPE_VARB,
|
||||
WOP_TYPE_COND
|
||||
#ifdef QUAKE4
|
||||
, WOP_TYPE_VARFM
|
||||
#endif
|
||||
} wexpOpType_t;
|
||||
|
||||
typedef enum {
|
||||
@@ -103,12 +112,12 @@ typedef enum {
|
||||
} wexpRegister_t;
|
||||
|
||||
typedef struct {
|
||||
wexpOpType_t opType;
|
||||
wexpOpType_t opType;
|
||||
intptr_t a, b, c, d;
|
||||
} wexpOp_t;
|
||||
|
||||
struct idRegEntry {
|
||||
const char *name;
|
||||
const char* name;
|
||||
idRegister::REGTYPE type;
|
||||
int index;
|
||||
};
|
||||
@@ -124,7 +133,7 @@ struct idTimeLineEvent {
|
||||
delete event;
|
||||
}
|
||||
int time;
|
||||
idGuiScriptList *event;
|
||||
idGuiScriptList* event;
|
||||
bool pending;
|
||||
size_t Size() {
|
||||
return sizeof(*this) + event->Size();
|
||||
@@ -138,23 +147,23 @@ public:
|
||||
rvNamedEvent(const char* name)
|
||||
{
|
||||
mEvent = new idGuiScriptList;
|
||||
mName = name;
|
||||
mName = name;
|
||||
}
|
||||
~rvNamedEvent(void)
|
||||
{
|
||||
delete mEvent;
|
||||
}
|
||||
size_t Size()
|
||||
size_t Size()
|
||||
{
|
||||
return sizeof(*this) + mEvent->Size();
|
||||
}
|
||||
|
||||
|
||||
idStr mName;
|
||||
idGuiScriptList* mEvent;
|
||||
idGuiScriptList* mEvent;
|
||||
};
|
||||
|
||||
struct idTransitionData {
|
||||
idWinVar *data;
|
||||
idWinVar* data;
|
||||
int offset;
|
||||
idInterpolateAccelDecelLinear<idVec4> interp;
|
||||
};
|
||||
@@ -163,14 +172,17 @@ struct idTransitionData {
|
||||
class idUserInterfaceLocal;
|
||||
class idWindow {
|
||||
public:
|
||||
idWindow(idUserInterfaceLocal *gui);
|
||||
idWindow(idDeviceContext *d, idUserInterfaceLocal *gui);
|
||||
idWindow(idUserInterfaceLocal* gui);
|
||||
idWindow(idDeviceContext* d, idUserInterfaceLocal* gui);
|
||||
virtual ~idWindow();
|
||||
|
||||
enum {
|
||||
ON_MOUSEENTER = 0,
|
||||
ON_MOUSEEXIT,
|
||||
ON_ACTION,
|
||||
#ifdef QUAKE4
|
||||
ON_ACTIONRIGHT, // Q4 secondary / mouse2 action slot
|
||||
#endif
|
||||
ON_ACTIVATE,
|
||||
ON_DEACTIVATE,
|
||||
ON_ESC,
|
||||
@@ -179,6 +191,24 @@ public:
|
||||
ON_ACTIONRELEASE,
|
||||
ON_ENTER,
|
||||
ON_ENTERRELEASE,
|
||||
#ifdef QUAKE4
|
||||
ON_ESCRELEASE, // reserved Q4 slot
|
||||
ON_GAINFOCUS,
|
||||
ON_LOSEFOCUS,
|
||||
ON_RESERVED15, // reserved Q4 slot
|
||||
ON_INIT,
|
||||
ON_JOYBUTTON3,
|
||||
ON_JOYACTION,
|
||||
ON_JOYBACK,
|
||||
ON_JOYLSHOULDER,
|
||||
ON_JOYRSHOULDER,
|
||||
ON_JOYLEFT,
|
||||
ON_JOYRIGHT,
|
||||
ON_JOYDOWN,
|
||||
ON_JOYUP,
|
||||
ON_JOYBUTTON1,
|
||||
ON_JOYBUTTON2,
|
||||
#endif
|
||||
SCRIPT_COUNT
|
||||
};
|
||||
|
||||
@@ -194,66 +224,71 @@ public:
|
||||
ADJUST_BOTTOMLEFT
|
||||
};
|
||||
|
||||
static const char *ScriptNames[SCRIPT_COUNT];
|
||||
static const char* ScriptNames[SCRIPT_COUNT];
|
||||
|
||||
static const idRegEntry RegisterVars[];
|
||||
static const int NumRegisterVars;
|
||||
|
||||
void SetDC(idDeviceContext *d);
|
||||
void SetDC(idDeviceContext* d);
|
||||
|
||||
idDeviceContext* GetDC ( void ) { return dc; }
|
||||
idDeviceContext* GetDC(void) { return dc; }
|
||||
|
||||
idWindow *SetFocus(idWindow *w, bool scripts = true);
|
||||
idWindow* SetFocus(idWindow* w, bool scripts = true);
|
||||
|
||||
idWindow *SetCapture(idWindow *w);
|
||||
void SetParent(idWindow *w);
|
||||
idWindow* SetCapture(idWindow* w);
|
||||
void SetParent(idWindow* w);
|
||||
void SetFlag(unsigned int f);
|
||||
void ClearFlag(unsigned int f);
|
||||
unsigned GetFlags() {return flags;};
|
||||
unsigned GetFlags() { return flags; };
|
||||
void Move(float x, float y);
|
||||
void BringToTop(idWindow *w);
|
||||
void BringToTop(idWindow* w);
|
||||
void Adjust(float xd, float yd);
|
||||
void SetAdjustMode(idWindow *child);
|
||||
void SetAdjustMode(idWindow* child);
|
||||
void Size(float x, float y, float w, float h);
|
||||
void SetupFromState();
|
||||
void SetupBackground();
|
||||
drawWin_t *FindChildByName(const char *name);
|
||||
idSimpleWindow *FindSimpleWinByName(const char *_name);
|
||||
idWindow *GetParent() { return parent; }
|
||||
idUserInterfaceLocal *GetGui() {return gui;};
|
||||
drawWin_t* FindChildByName(const char* name);
|
||||
idSimpleWindow* FindSimpleWinByName(const char* _name);
|
||||
idWindow* GetParent() { return parent; }
|
||||
idUserInterfaceLocal* GetGui() { return gui; };
|
||||
bool Contains(float x, float y);
|
||||
size_t Size();
|
||||
virtual size_t Allocated();
|
||||
idStr* GetStrPtrByName(const char *_name);
|
||||
idStr* GetStrPtrByName(const char* _name);
|
||||
|
||||
virtual idWinVar *GetWinVarByName (const char *_name, bool winLookup = false, drawWin_t** owner = NULL);
|
||||
virtual idWinVar* GetWinVarByName(const char* _name, bool winLookup = false, drawWin_t** owner = NULL);
|
||||
|
||||
INT_PTR GetWinVarOffset( idWinVar *wv, drawWin_t *dw );
|
||||
intptr_t GetWinVarOffset(idWinVar* wv, drawWin_t* dw);
|
||||
float GetMaxCharHeight();
|
||||
float GetMaxCharWidth();
|
||||
void SetFont();
|
||||
void SetInitialState(const char *_name);
|
||||
void AddChild(idWindow *win);
|
||||
void SetInitialState(const char* _name);
|
||||
void AddChild(idWindow* win);
|
||||
void DebugDraw(int time, float x, float y);
|
||||
void CalcClientRect(float xofs, float yofs);
|
||||
void CommonInit();
|
||||
void CleanUp();
|
||||
void DrawBorderAndCaption(const idRectangle &drawRect);
|
||||
void DrawBorderAndCaption(const idRectangle& drawRect);
|
||||
void DrawCaption(int time, float x, float y);
|
||||
void SetupTransforms(float x, float y);
|
||||
bool Contains(const idRectangle &sr, float x, float y);
|
||||
const char *GetName() { return name; };
|
||||
bool Contains(const idRectangle& sr, float x, float y);
|
||||
const char* GetName() { return name; };
|
||||
|
||||
virtual bool Parse(idParser *src, bool rebuild = true);
|
||||
virtual const char *HandleEvent(const sysEvent_t *event, bool *updateVisuals);
|
||||
virtual bool Parse(idParser* src, bool rebuild = true);
|
||||
virtual const char* HandleEvent(const sysEvent_t* event, bool* updateVisuals);
|
||||
void CalcRects(float x, float y);
|
||||
virtual void Redraw(float x, float y);
|
||||
|
||||
virtual void ArchiveToDictionary(idDict *dict, bool useNames = true);
|
||||
virtual void InitFromDictionary(idDict *dict, bool byName = true);
|
||||
virtual void ArchiveToDictionary(idDict* dict, bool useNames = true);
|
||||
virtual void InitFromDictionary(idDict* dict, bool byName = true);
|
||||
virtual void PostParse();
|
||||
virtual void Activate( bool activate, idStr &act );
|
||||
virtual void Activate(bool activate, idStr& act);
|
||||
virtual void Trigger();
|
||||
#ifdef QUAKE4
|
||||
virtual void Init();
|
||||
virtual bool RunControllerScript(int script, const sysEvent_t* event, bool* updateVisuals);
|
||||
virtual bool RouteJoystickChange(int xd, int yd);
|
||||
#endif
|
||||
virtual void GainFocus();
|
||||
virtual void LoseFocus();
|
||||
virtual void GainCapture();
|
||||
@@ -263,105 +298,115 @@ public:
|
||||
virtual void Draw(int time, float x, float y);
|
||||
virtual void MouseExit();
|
||||
virtual void MouseEnter();
|
||||
virtual void DrawBackground(const idRectangle &drawRect);
|
||||
virtual const char *RouteMouseCoords(float xd, float yd);
|
||||
virtual void SetBuddy(idWindow *buddy) {};
|
||||
virtual void HandleBuddyUpdate(idWindow *buddy) {};
|
||||
virtual void StateChanged( bool redraw );
|
||||
virtual void ReadFromDemoFile( class idDemoFile *f, bool rebuild = true );
|
||||
virtual void WriteToDemoFile( class idDemoFile *f );
|
||||
virtual void DrawBackground(const idRectangle& drawRect);
|
||||
virtual const char* RouteMouseCoords(float xd, float yd);
|
||||
virtual void SetBuddy(idWindow* buddy) {};
|
||||
virtual void HandleBuddyUpdate(idWindow* buddy) {};
|
||||
virtual void StateChanged(bool redraw);
|
||||
virtual void ReadFromDemoFile(class idDemoFile* f, bool rebuild = true);
|
||||
virtual void WriteToDemoFile(class idDemoFile* f);
|
||||
|
||||
// SaveGame support
|
||||
void WriteSaveGameString( const char *string, idFile *savefile );
|
||||
void WriteSaveGameTransition( idTransitionData &trans, idFile *savefile );
|
||||
virtual void WriteToSaveGame( idFile *savefile );
|
||||
void ReadSaveGameString( idStr &string, idFile *savefile );
|
||||
void ReadSaveGameTransition( idTransitionData & trans, idFile *savefile );
|
||||
virtual void ReadFromSaveGame( idFile *savefile );
|
||||
void WriteSaveGameString(const char* string, idFile* savefile);
|
||||
void WriteSaveGameTransition(idTransitionData& trans, idFile* savefile);
|
||||
virtual void WriteToSaveGame(idFile* savefile);
|
||||
void ReadSaveGameString(idStr& string, idFile* savefile);
|
||||
void ReadSaveGameTransition(idTransitionData& trans, idFile* savefile);
|
||||
virtual void ReadFromSaveGame(idFile* savefile);
|
||||
void FixupTransitions();
|
||||
virtual void HasAction(){};
|
||||
virtual void HasScripts(){};
|
||||
virtual void HasAction() {};
|
||||
virtual void HasScripts() {};
|
||||
|
||||
void FixupParms();
|
||||
void GetScriptString(const char *name, idStr &out);
|
||||
void GetScriptString(const char* name, idStr& out);
|
||||
void SetScriptParams();
|
||||
bool HasOps() { return (ops.Num() > 0); };
|
||||
bool HasOps() { return (ops.Num() > 0); };
|
||||
float EvalRegs(int test = -1, bool force = false);
|
||||
void StartTransition();
|
||||
void AddTransition(idWinVar *dest, idVec4 from, idVec4 to, int time, float accelTime, float decelTime);
|
||||
void AddTransition(idWinVar* dest, idVec4 from, idVec4 to, int time, float accelTime, float decelTime);
|
||||
#ifdef QUAKE4
|
||||
void ClearTransitions();
|
||||
#endif
|
||||
void ResetTime(int time);
|
||||
void ResetCinematics();
|
||||
#ifdef QUAKE4
|
||||
bool IsVisible() const;
|
||||
void SetWrapper(int wrapper);
|
||||
#endif
|
||||
|
||||
int NumTransitions();
|
||||
|
||||
bool ParseScript(idParser *src, idGuiScriptList &list, int *timeParm = NULL, bool allowIf = false);
|
||||
bool ParseScript(idParser* src, idGuiScriptList& list, int* timeParm = NULL, bool allowIf = false);
|
||||
bool RunScript(int n);
|
||||
bool RunScriptList(idGuiScriptList *src);
|
||||
void SetRegs(const char *key, const char *val);
|
||||
intptr_t ParseExpression( idParser *src, idWinVar *var = NULL, intptr_t component = 0 );
|
||||
bool RunScriptList(idGuiScriptList* src);
|
||||
void SetRegs(const char* key, const char* val);
|
||||
intptr_t ParseExpression(idParser* src, idWinVar* var = NULL, intptr_t component = 0);
|
||||
int ExpressionConstant(float f);
|
||||
idRegisterList *RegList() { return ®List; }
|
||||
void AddCommand(const char *cmd);
|
||||
void AddUpdateVar(idWinVar *var);
|
||||
idRegisterList* RegList() { return ®List; }
|
||||
void AddCommand(const char* cmd);
|
||||
void AddUpdateVar(idWinVar* var);
|
||||
bool Interactive();
|
||||
bool ContainsStateVars();
|
||||
void SetChildWinVarVal(const char *name, const char *var, const char *val);
|
||||
idWindow *GetFocusedChild();
|
||||
idWindow *GetCaptureChild();
|
||||
const char *GetComment() { return comment; }
|
||||
void SetComment( const char * p) { comment = p; }
|
||||
void SetChildWinVarVal(const char* name, const char* var, const char* val);
|
||||
idWindow* GetFocusedChild();
|
||||
idWindow* GetCaptureChild();
|
||||
const char* GetComment() { return comment; }
|
||||
void SetComment(const char* p) { comment = p; }
|
||||
|
||||
idStr cmd;
|
||||
|
||||
virtual void RunNamedEvent ( const char* eventName );
|
||||
virtual void RunNamedEvent(const char* eventName);
|
||||
|
||||
void AddDefinedVar ( idWinVar* var );
|
||||
void AddDefinedVar(idWinVar* var);
|
||||
|
||||
idWindow* FindChildByPoint ( float x, float y, idWindow* below = NULL );
|
||||
int GetChildIndex ( idWindow* window );
|
||||
int GetChildCount ( void );
|
||||
idWindow* GetChild ( int index );
|
||||
void RemoveChild ( idWindow *win );
|
||||
bool InsertChild ( idWindow *win, idWindow* before );
|
||||
idWindow* FindChildByPoint(float x, float y, idWindow* below = NULL);
|
||||
int GetChildIndex(idWindow* window);
|
||||
int GetChildCount(void);
|
||||
idWindow* GetChild(int index);
|
||||
void RemoveChild(idWindow* win);
|
||||
bool InsertChild(idWindow* win, idWindow* before);
|
||||
|
||||
void ScreenToClient ( idRectangle* rect );
|
||||
void ClientToScreen ( idRectangle* rect );
|
||||
void ScreenToClient(idRectangle* rect);
|
||||
void ClientToScreen(idRectangle* rect);
|
||||
|
||||
bool UpdateFromDictionary ( idDict& dict );
|
||||
bool UpdateFromDictionary(idDict& dict);
|
||||
|
||||
protected:
|
||||
|
||||
friend class rvGEWindowWrapper;
|
||||
|
||||
idWindow* FindChildByPoint ( float x, float y, idWindow** below );
|
||||
void SetDefaults ( void );
|
||||
idWindow* FindChildByPoint(float x, float y, idWindow** below);
|
||||
#ifdef QUAKE4
|
||||
void FindBestChild_r(int xd, int yd, int& startX, int& startY, int& bestX, int& bestY, idWindow* current, idWindow*& best);
|
||||
#endif
|
||||
void SetDefaults(void);
|
||||
|
||||
friend class idSimpleWindow;
|
||||
friend class idUserInterfaceLocal;
|
||||
bool IsSimple();
|
||||
void UpdateWinVars();
|
||||
void DisableRegister(const char *_name);
|
||||
void DisableRegister(const char* _name);
|
||||
void Transition();
|
||||
void Time();
|
||||
bool RunTimeEvents(int time);
|
||||
void Dump();
|
||||
|
||||
int ExpressionTemporary();
|
||||
wexpOp_t *ExpressionOp();
|
||||
intptr_t EmitOp(intptr_t a, intptr_t b, wexpOpType_t opType, wexpOp_t **opp = NULL );
|
||||
intptr_t ParseEmitOp( idParser *src, intptr_t a, wexpOpType_t opType, int priority, wexpOp_t **opp = NULL );
|
||||
intptr_t ParseTerm( idParser *src, idWinVar *var = NULL, intptr_t component = 0 );
|
||||
intptr_t ParseExpressionPriority( idParser *src, int priority, idWinVar *var = NULL, intptr_t component = 0 );
|
||||
void EvaluateRegisters(float *registers);
|
||||
wexpOp_t* ExpressionOp();
|
||||
intptr_t EmitOp(intptr_t a, intptr_t b, wexpOpType_t opType, wexpOp_t** opp = NULL);
|
||||
intptr_t ParseEmitOp(idParser* src, intptr_t a, wexpOpType_t opType, int priority, wexpOp_t** opp = NULL);
|
||||
intptr_t ParseTerm(idParser* src, idWinVar* var = NULL, intptr_t component = 0);
|
||||
intptr_t ParseExpressionPriority(idParser* src, int priority, idWinVar* var = NULL, intptr_t component = 0);
|
||||
void EvaluateRegisters(float* registers);
|
||||
void SaveExpressionParseState();
|
||||
void RestoreExpressionParseState();
|
||||
void ParseBracedExpression(idParser *src);
|
||||
bool ParseScriptEntry(const char *name, idParser *src);
|
||||
bool ParseRegEntry(const char *name, idParser *src);
|
||||
virtual bool ParseInternalVar(const char *name, idParser *src);
|
||||
void ParseString(idParser *src, idStr &out);
|
||||
void ParseVec4(idParser *src, idVec4 &out);
|
||||
void ConvertRegEntry(const char *name, idParser *src, idStr &out, int tabs);
|
||||
void ParseBracedExpression(idParser* src);
|
||||
bool ParseScriptEntry(const char* name, idParser* src);
|
||||
bool ParseRegEntry(const char* name, idParser* src);
|
||||
virtual bool ParseInternalVar(const char* name, idParser* src);
|
||||
void ParseString(idParser* src, idStr& out);
|
||||
void ParseVec4(idParser* src, idVec4& out);
|
||||
void ConvertRegEntry(const char* name, idParser* src, idStr& out, int tabs);
|
||||
|
||||
float actualX; // physical coords
|
||||
float actualY; // ''
|
||||
@@ -373,7 +418,7 @@ protected:
|
||||
idVec2 origin;
|
||||
|
||||
int timeLine; // time stamp used for various fx
|
||||
float xOffset;
|
||||
float xOffset;
|
||||
float yOffset;
|
||||
float forceAspectWidth;
|
||||
float forceAspectHeight;
|
||||
@@ -387,9 +432,15 @@ protected:
|
||||
idVec2 shear;
|
||||
|
||||
signed char textShadow;
|
||||
#ifdef QUAKE4
|
||||
signed char textStyle;
|
||||
#endif
|
||||
unsigned char fontNum;
|
||||
unsigned char cursor; //
|
||||
signed char textAlign;
|
||||
#ifdef QUAKE4
|
||||
float textSpacing;
|
||||
#endif
|
||||
|
||||
idWinBool noTime; //
|
||||
idWinBool visible; //
|
||||
@@ -409,45 +460,132 @@ protected:
|
||||
idList<idWinVar*> updateVars;
|
||||
|
||||
idRectangle textRect; // text extented rect
|
||||
const idMaterial *background; // background asset
|
||||
const idMaterial* background; // background asset
|
||||
|
||||
idWindow *parent; // parent window
|
||||
idWindow* parent; // parent window
|
||||
idList<idWindow*> children; // child windows
|
||||
idList<drawWin_t> drawWindows;
|
||||
idList<drawWin_t> drawWindows;
|
||||
#ifdef QUAKE4
|
||||
int startChildSearch; // Q4 child-lookup optimization
|
||||
idWindow* currentChild; // controller navigation helper
|
||||
#endif
|
||||
|
||||
idWindow *focusedChild; // if a child window has the focus
|
||||
idWindow *captureChild; // if a child window has mouse capture
|
||||
idWindow *overChild; // if a child window has mouse capture
|
||||
idWindow* focusedChild; // if a child window has the focus
|
||||
idWindow* captureChild; // if a child window has mouse capture
|
||||
idWindow* overChild; // if a child window has mouse capture
|
||||
bool hover;
|
||||
|
||||
idDeviceContext *dc;
|
||||
idDeviceContext* dc;
|
||||
|
||||
idUserInterfaceLocal *gui;
|
||||
idUserInterfaceLocal* gui;
|
||||
|
||||
static idCVar gui_debug;
|
||||
static idCVar gui_edit;
|
||||
|
||||
idGuiScriptList *scripts[SCRIPT_COUNT];
|
||||
bool *saveTemps;
|
||||
idGuiScriptList* scripts[SCRIPT_COUNT];
|
||||
bool* saveTemps;
|
||||
|
||||
idList<idTimeLineEvent*> timeLineEvents;
|
||||
idList<idTransitionData> transitions;
|
||||
#ifdef QUAKE4
|
||||
idList<intptr_t> transitionSubs;
|
||||
#endif
|
||||
|
||||
static bool registerIsTemporary[MAX_EXPRESSION_REGISTERS]; // statics to assist during parsing
|
||||
|
||||
idList<wexpOp_t> ops; // evaluate to make expressionRegisters
|
||||
idList<float> expressionRegisters;
|
||||
idList<wexpOp_t> *saveOps; // evaluate to make expressionRegisters
|
||||
idList<wexpOp_t>* saveOps; // evaluate to make expressionRegisters
|
||||
idList<rvNamedEvent*> namedEvents; // added named events
|
||||
idList<float> *saveRegs;
|
||||
idList<float>* saveRegs;
|
||||
|
||||
idRegisterList regList;
|
||||
|
||||
idWinBool hideCursor;
|
||||
};
|
||||
|
||||
ID_INLINE void idWindow::AddDefinedVar( idWinVar* var ) {
|
||||
definedVars.AddUnique( var );
|
||||
ID_INLINE void idWindow::AddDefinedVar(idWinVar* var) {
|
||||
definedVars.AddUnique(var);
|
||||
}
|
||||
|
||||
#endif /* !__WINDOW_H__ */
|
||||
|
||||
#ifdef QUAKE4
|
||||
// Quake 4 added synthetic float-member window vars so expressions / transitions
|
||||
// can address rect_x, rect_y, forecolor_w, etc. Doom 3 does not ship one, so
|
||||
// we keep the helper local to Window.cpp.
|
||||
class idWinFloatMember : public idWinVar {
|
||||
public:
|
||||
idWinFloatMember() : owner(NULL), component(0) {}
|
||||
idWinFloatMember(idWinVar* base, int index) : owner(base), component(index) {}
|
||||
|
||||
virtual void Init(const char* name, idWindow* win) {
|
||||
idWinVar::Init(name, win);
|
||||
}
|
||||
virtual void Update() {
|
||||
if (owner) {
|
||||
owner->Update();
|
||||
}
|
||||
}
|
||||
virtual void Set(const char* value) {
|
||||
if (!owner) {
|
||||
return;
|
||||
}
|
||||
float f = static_cast<float>(atof(value));
|
||||
if (idWinVec4* v4 = dynamic_cast<idWinVec4*>(owner)) {
|
||||
(*v4)[component] = f;
|
||||
}
|
||||
else if (idWinRectangle* r = dynamic_cast<idWinRectangle*>(owner)) {
|
||||
switch (component) {
|
||||
case 0: r->data.x = f; break;
|
||||
case 1: r->data.y = f; break;
|
||||
case 2: r->data.w = f; break;
|
||||
case 3: r->data.h = f; break;
|
||||
}
|
||||
}
|
||||
}
|
||||
virtual const char* c_str() const {
|
||||
return va("%g", x());
|
||||
}
|
||||
virtual float x() const {
|
||||
if (!owner) {
|
||||
return 0.0f;
|
||||
}
|
||||
if (const idWinVec4* v4 = dynamic_cast<const idWinVec4*>(owner)) {
|
||||
return (*v4)[component];
|
||||
}
|
||||
if (const idWinRectangle* r = dynamic_cast<const idWinRectangle*>(owner)) {
|
||||
switch (component) {
|
||||
case 0: return r->data.x;
|
||||
case 1: return r->data.y;
|
||||
case 2: return r->data.w;
|
||||
case 3: return r->data.h;
|
||||
}
|
||||
}
|
||||
return 0.0f;
|
||||
}
|
||||
virtual void WriteToSaveGame(idFile* savefile) {
|
||||
idWinFloat temp;
|
||||
temp = x();
|
||||
temp.WriteToSaveGame(savefile);
|
||||
}
|
||||
virtual void ReadFromSaveGame(idFile* savefile) {
|
||||
idWinFloat temp;
|
||||
temp.ReadFromSaveGame(savefile);
|
||||
Set(va("%g", temp.data));
|
||||
}
|
||||
virtual size_t Size() {
|
||||
return sizeof(*this);
|
||||
}
|
||||
|
||||
idWinVar* GetOwner() const { return owner; }
|
||||
int GetComponent() const { return component; }
|
||||
|
||||
private:
|
||||
idWinVar* owner;
|
||||
int component;
|
||||
};
|
||||
|
||||
#endif // QUAKE4
|
||||
|
||||
|
||||
#endif /* !__WINDOW_H__ */
|
||||
+22
-19
@@ -1,50 +1,52 @@
|
||||
/*
|
||||
===========================================================================
|
||||
|
||||
IceTech GPL Source Code
|
||||
Copyright (C) 2026 Justin Marshall
|
||||
Doom 3 GPL Source Code
|
||||
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the IceTech GPL Source Code ("IceTech Source Code").
|
||||
This file is part of the Doom 3 GPL Source Code (?Doom 3 Source Code?).
|
||||
|
||||
IceTech Source Code is free software: you can redistribute it and/or modify
|
||||
Doom 3 Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
IceTech Source Code is distributed in the hope that it will be useful,
|
||||
Doom 3 Source Code 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 IceTech Source Code. If not, see <http://www.gnu.org/licenses/>.
|
||||
along with Doom 3 Source Code. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
In addition, the IceTech Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the IceTech Source Code. If not, please request a copy in writing from id Software at the address below.
|
||||
In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below.
|
||||
|
||||
If you have questions concerning this license or the applicable additional terms, you may contact in writing Justin Marshall, justinmarshall20@gmail.com
|
||||
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
|
||||
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
#include "precompiled.h"
|
||||
#include "Window.h"
|
||||
#include "UserInterfaceLocal.h"
|
||||
#include "Winvar.h"
|
||||
#pragma hdrstop
|
||||
|
||||
idWinVar::idWinVar() {
|
||||
guiDict = NULL;
|
||||
name = NULL;
|
||||
#include "Window.h"
|
||||
#include "Winvar.h"
|
||||
#include "UserInterfaceLocal.h"
|
||||
|
||||
idWinVar::idWinVar() {
|
||||
guiDict = NULL;
|
||||
name = NULL;
|
||||
eval = true;
|
||||
}
|
||||
|
||||
idWinVar::~idWinVar() {
|
||||
delete[] name;
|
||||
idWinVar::~idWinVar() {
|
||||
delete name;
|
||||
name = NULL;
|
||||
}
|
||||
|
||||
void idWinVar::SetGuiInfo(idDict *gd, const char *_name) {
|
||||
guiDict = gd;
|
||||
SetName(_name);
|
||||
void idWinVar::SetGuiInfo(idDict *gd, const char *_name) {
|
||||
guiDict = gd;
|
||||
SetName(_name);
|
||||
}
|
||||
|
||||
|
||||
@@ -78,3 +80,4 @@ void idMultiWinVar::SetGuiInfo( idDict *dict ) {
|
||||
(*this)[i]->SetGuiInfo( dict, (*this)[i]->c_str() );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+339
-243
File diff suppressed because it is too large
Load Diff
@@ -306,7 +306,7 @@ void idCollisionModelManagerLocal::LoadProcBSP( const char *name ) {
|
||||
}
|
||||
|
||||
// jmarshall: quake 4 proc format
|
||||
if (!src->ReadToken(&token) || token.Icmp(va("%s", PROC_FILEVERSION))) {
|
||||
if (!src->ReadToken(&token)) {
|
||||
common->Printf("idRenderWorldLocal::InitFromMap: bad version '%s' instead of '%s'\n", token.c_str(), PROC_FILEVERSION);
|
||||
delete src;
|
||||
return;
|
||||
|
||||
@@ -176,6 +176,7 @@ public:
|
||||
virtual void MenuFrame( void ) = 0;
|
||||
|
||||
virtual byte* MT_GetMaterialTypeArray(idStr image, int& width, int& height) = 0;
|
||||
virtual void MT_FreeMaterialTypeArray(byte* buffer) = 0;
|
||||
// RAVEN END
|
||||
|
||||
// Runs a repeater frame
|
||||
|
||||
@@ -13,6 +13,10 @@
|
||||
#include "Game_Log.h"
|
||||
// RAVEN END
|
||||
|
||||
#include "../bse/BSE_Envelope.h"
|
||||
#include "../bse/BSE_Particle.h"
|
||||
#include "../bse/BSE.h"
|
||||
|
||||
//#define UI_DEBUG 1
|
||||
|
||||
#ifdef GAME_DLL
|
||||
@@ -394,6 +398,11 @@ idGameLocal::Init
|
||||
initialize the game object, only happens once at startup, not each level load
|
||||
============
|
||||
*/
|
||||
static idDecl* AllocEffectDecl(void) {
|
||||
idDecl* decl = new rvDeclEffect();
|
||||
return decl;
|
||||
}
|
||||
|
||||
// RAVEN BEGIN
|
||||
// jsinger: attempt to eliminate cross-DLL allocation issues
|
||||
extern idHashTable<rvViseme> *visemeTable100;
|
||||
@@ -459,6 +468,9 @@ void idGameLocal::Init( void ) {
|
||||
declManager->RegisterDeclFolder("materials/types", ".mtt", DECL_MATERIALTYPE);
|
||||
declManager->RegisterDeclFolder("lipsync", ".lipsync", DECL_LIPSYNC);
|
||||
declManager->RegisterDeclFolder("playbacks", ".playback", DECL_PLAYBACK);
|
||||
|
||||
declManager->RegisterDeclType("effect", DECL_EFFECT, AllocEffectDecl);
|
||||
declManager->RegisterDeclFolder("effects", ".fx", DECL_EFFECT);
|
||||
// jmarshall end
|
||||
|
||||
// jsinger: added to support serialization/deserialization of binary decls
|
||||
@@ -8417,7 +8429,16 @@ idGameLocal::MT_GetMaterialTypeArray
|
||||
============
|
||||
*/
|
||||
byte* idGameLocal::MT_GetMaterialTypeArray(idStr image, int& width, int& height) {
|
||||
return MT_GetMaterialTypeArray(image, width, height);
|
||||
return ::MT_GetMaterialTypeArray(image, width, height);
|
||||
}
|
||||
|
||||
/*
|
||||
===========
|
||||
idGameLocal::MT_FreeMaterialTypeArray
|
||||
============
|
||||
*/
|
||||
void idGameLocal::MT_FreeMaterialTypeArray(byte* buffer) {
|
||||
free(buffer);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -577,6 +577,7 @@ public:
|
||||
// RAVEN END
|
||||
|
||||
virtual byte* MT_GetMaterialTypeArray(idStr image, int& width, int& height);
|
||||
virtual void MT_FreeMaterialTypeArray(byte* buffer);
|
||||
|
||||
virtual int GetTimeGroupTime(int timeGroup);
|
||||
virtual void SelectTimeGroup(int timeGroup);
|
||||
|
||||
@@ -25,7 +25,7 @@ int LexerFactory::GetReadBinary()
|
||||
{
|
||||
if(cvarSystem->GetCVarBool("com_binaryRead"))
|
||||
{
|
||||
return LEXFL_READBINARY;
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -42,10 +42,10 @@ int LexerFactory::GetWriteBinary()
|
||||
case 0:
|
||||
break;
|
||||
case 1:
|
||||
ret = LEXFL_WRITEBINARY;
|
||||
ret = 0;
|
||||
break;
|
||||
case 2:
|
||||
ret = LEXFL_WRITEBINARY | LEXFL_BYTESWAP;
|
||||
ret = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user