C# Class SharpQuake.Progs

Exibir arquivo Open project: Memorix101/SharpQuake Class Usage Examples

Public Properties

Property Type Description
GlobalStruct globalvars_t
Trace bool
xFunction dfunction_t

Public Methods

Method Description
AllocString ( ) : int
EdictFromAddr ( int addr, int &ofs ) : edict_t
Execute ( int fnum ) : void

PR_ExecuteProgram

GetEdictFieldFloat ( edict_t ed, string field, float defValue ) : float
GetString ( int strId ) : string
Init ( ) : void
LoadFromFile ( string data ) : void

ED_LoadFromFile The entities are directly placed in the array, rather than allocated with ED_Alloc, because otherwise an error loading the map would have entity number references out of order. Creates a server's entity / program execution context by parsing textual entity definitions out of an ent file. Used for both fresh maps and savegame loads. A fresh map would also need to call ED_CallSpawnFunctions () to let the objects initialize themselves.

LoadProgs ( ) : void

PR_LoadProgs

NewString ( string s ) : int

Like ED_NewString but returns string id (string_t)

ParseEdict ( string data, edict_t ent ) : string

ED_ParseEdict Parses an edict out of the given string, returning the new position ed should be a properly initialized empty edict. Used for initial level load and for savegames.

ParseGlobals ( string data ) : void

ED_ParseGlobals

Print ( edict_t ed ) : void

ED_Print For debugging

PrintEdicts ( ) : void
PrintNum ( int ent ) : void

ED_PrintNum

RunError ( string fmt ) : void

PR_RunError Aborts the currently executing function

SameName ( int name1, string name2 ) : bool
SetEdictFieldFloat ( edict_t ed, string field, float value ) : bool
SetString ( int id, string value ) : void
StringOffset ( string value ) : int
WriteEdict ( StreamWriter writer, edict_t ed ) : void

ED_Write

WriteGlobals ( StreamWriter writer ) : void

ED_WriteGlobals

Private Methods

Method Description
CachedSearch ( edict_t ed, string field ) : ddef_t
EdictCount ( ) : void
EnterFunction ( dfunction_t f ) : int

PR_EnterFunction Returns the new program statement counter

FindField ( int ofs ) : ddef_t

ED_FieldAtOfs

FindField ( string name ) : ddef_t

ED_FindField

FindFunction ( string name ) : dfunction_t

ED_FindFunction

FindGlobal ( string name ) : ddef_t

ED_FindGlobal

FreeHandles ( ) : void
Get ( int offset ) : void*

Mimics G_xxx macros But globals are split too, so we must check offset and choose GlobalStruct or _Globals

GetInt32 ( int offset ) : int
GlobalAtOfs ( int ofs ) : ddef_t

ED_GlobalAtOfs

GlobalString ( int ofs ) : string

PR_GlobalString Returns a string with a description and the contents of a global, padded to 20 field width

GlobalStringNoContents ( int ofs ) : string

PR_GlobalStringNoContents

IndexOfField ( int ofs ) : int
IndexOfField ( string name ) : int
IndexOfFunction ( string name ) : int
IsEmptyField ( int type, int v ) : bool
IsGlobalStruct ( int ofs, int &offset ) : bool

Returns true if ofs is inside GlobalStruct or false if ofs is in _Globals Out parameter offset is set to correct offset inside either GlobalStruct or _Globals

IsStaticString ( int stringId, int &offset ) : bool
LeaveFunction ( ) : int

PR_LeaveFunction

MakeAddr ( int prog, int offset ) : int
MakeStingId ( int index, bool isStatic ) : int
ParseGlobalPair ( ddef_t key, string value ) : bool
ParsePair ( edict_t ent, ddef_t key, string s ) : bool

Since memory block containing original edict_t plus additional data is split into two fiels - edict_t.v and edict_t.fields we must check key.ofs to choose between thistwo parts. Warning: Key offset is in integers not bytes!

ParsePair ( void value, ddef_t key, string s ) : bool

ED_ParseEpair Can parse either fields or globals returns false if error Uze: Warning! value pointer is already with correct offset (value = base + key.ofs)!

PrintEdict_f ( ) : void

ED_PrintEdict_f For debugging, prints a single edict

PrintStatement ( dstatement_t &s ) : void

PR_PrintStatement

Profile_f ( ) : void
Set ( int offset, int value ) : void
StackTrace ( ) : void

PR_StackTrace

Test5_f ( ) : void
UglyValueString ( etype_t type, eval_t val ) : string

PR_UglyValueString Returns a string describing *data in a type specific manner Easier to parse than PR_ValueString

ValueString ( etype_t type, void val ) : string

PR_ValueString

Method Details

AllocString() public static method

public static AllocString ( ) : int
return int

EdictFromAddr() public static method

public static EdictFromAddr ( int addr, int &ofs ) : edict_t
addr int
ofs int
return edict_t

Execute() public static method

PR_ExecuteProgram
public static Execute ( int fnum ) : void
fnum int
return void

GetEdictFieldFloat() public static method

public static GetEdictFieldFloat ( edict_t ed, string field, float defValue ) : float
ed edict_t
field string
defValue float
return float

GetString() public static method

public static GetString ( int strId ) : string
strId int
return string

Init() public static method

public static Init ( ) : void
return void

LoadFromFile() public static method

ED_LoadFromFile The entities are directly placed in the array, rather than allocated with ED_Alloc, because otherwise an error loading the map would have entity number references out of order. Creates a server's entity / program execution context by parsing textual entity definitions out of an ent file. Used for both fresh maps and savegame loads. A fresh map would also need to call ED_CallSpawnFunctions () to let the objects initialize themselves.
public static LoadFromFile ( string data ) : void
data string
return void

LoadProgs() public static method

PR_LoadProgs
public static LoadProgs ( ) : void
return void

NewString() public static method

Like ED_NewString but returns string id (string_t)
public static NewString ( string s ) : int
s string
return int

ParseEdict() public static method

ED_ParseEdict Parses an edict out of the given string, returning the new position ed should be a properly initialized empty edict. Used for initial level load and for savegames.
public static ParseEdict ( string data, edict_t ent ) : string
data string
ent edict_t
return string

ParseGlobals() public static method

ED_ParseGlobals
public static ParseGlobals ( string data ) : void
data string
return void

Print() public static method

ED_Print For debugging
public static Print ( edict_t ed ) : void
ed edict_t
return void

PrintEdicts() public static method

public static PrintEdicts ( ) : void
return void

PrintNum() public static method

ED_PrintNum
public static PrintNum ( int ent ) : void
ent int
return void

RunError() public static method

PR_RunError Aborts the currently executing function
public static RunError ( string fmt ) : void
fmt string
return void

SameName() public static method

public static SameName ( int name1, string name2 ) : bool
name1 int
name2 string
return bool

SetEdictFieldFloat() public static method

public static SetEdictFieldFloat ( edict_t ed, string field, float value ) : bool
ed edict_t
field string
value float
return bool

SetString() public static method

public static SetString ( int id, string value ) : void
id int
value string
return void

StringOffset() public static method

public static StringOffset ( string value ) : int
value string
return int

WriteEdict() public static method

ED_Write
public static WriteEdict ( StreamWriter writer, edict_t ed ) : void
writer System.IO.StreamWriter
ed edict_t
return void

WriteGlobals() public static method

ED_WriteGlobals
public static WriteGlobals ( StreamWriter writer ) : void
writer System.IO.StreamWriter
return void

Property Details

GlobalStruct public_oe static_oe property

public static globalvars_t,SharpQuake GlobalStruct
return globalvars_t

Trace public_oe static_oe property

public static bool Trace
return bool

xFunction public_oe static_oe property

public static dfunction_t,SharpQuake xFunction
return dfunction_t