コード例 #1
0
ファイル: type.cpp プロジェクト: wh5a/xgill
TypePointer::TypePointer(Type *target_type, size_t width)
  : Type(YK_Pointer), m_target_type(target_type), m_width(width)
{
  Assert(m_target_type);
  m_hash = Hash32(m_hash, m_target_type->Hash());
  m_hash = Hash32(m_hash, m_width);
}
コード例 #2
0
Variable::Variable(BlockId *id, VarKind kind, String *name, size_t index,
                   String *source_name)
  : m_id(id), m_kind(kind),
    m_name(name), m_index(index), m_source_name(source_name),
    m_type(NULL)
{
  if (m_id)
    Assert(m_kind != VK_Func && m_kind != VK_Glob);

  if (m_kind == VK_Glob || kind == VK_Func ||
      kind == VK_Local || kind == VK_Temp)
    Assert(m_name);
  else if (m_kind != VK_Arg)
    Assert(!m_name);

  if (m_name == NULL)
    Assert(!m_source_name);

  if (m_id)
    m_hash = m_id->Hash();
  m_hash = Hash32(m_hash, m_kind);
  m_hash = Hash32(m_hash, m_index);
  if (m_name)
    m_hash = Hash32(m_hash, m_name->Hash());
}
コード例 #3
0
ファイル: type.cpp プロジェクト: wh5a/xgill
TypeArray::TypeArray(Type *element_type, size_t element_count)
  : Type(YK_Array),
    m_element_type(element_type), m_element_count(element_count)
{
  Assert(m_element_type);
  m_hash = Hash32(m_hash, m_element_count);
  m_hash = Hash32(m_hash, m_element_type->Hash());
}
コード例 #4
0
ファイル: GobBridge.cpp プロジェクト: Anters/LevelEditor
// ------------------------------------------------------------------------------------------------
void GobBridge::RegisterProperty(const char* typeName, const char* propName, SetPropertyFncPtr set, GetPropertyFncPtr get)
{
    ObjectTypeGUID tid = Hash32(typeName);
    ObjectPropertyUID pid = Hash32(propName);
    uint64_t tidpid = MakePair(tid, pid);
    assert(m_propertyFunctions.find(tidpid) == m_propertyFunctions.end()); // double registration.
    m_propertyFunctions[tidpid] = PropertyFunc(set, get);
}
コード例 #5
0
ファイル: GobBridge.cpp プロジェクト: Anters/LevelEditor
// ------------------------------------------------------------------------------------------------
void GobBridge::RegisterChildList(const char* typeName, const char* listName, AddChildFncPtr add, RemoveChildFncPtr remove)
{
    ObjectTypeGUID tid = Hash32(typeName);
    ObjectListUID lid = Hash32(listName);
    uint64_t tidlid = MakePair(tid, lid);
    assert(m_childListFunctions.find(tid) == m_childListFunctions.end()); // double registration.
    m_childListFunctions[tidlid] = ChildListFunc(add, remove);
}
コード例 #6
0
ファイル: Test5.c プロジェクト: miketwo/wilt-compressor
static void RunTests(TestFunctionPointer TestFunction,void *context)
{
	int weights1[33],weights2[33],max;

	for(int i=0;i<33;i++) weights1[i]=weights2[i]=0x800;

	for(int i=0;i<0x1000;i++) TestFunction(0,0,weights1,3,weights2,3,context);

	max=1;
	for(int e=0;e<32;e++)
	{
		for(int i=0;i<0x1000;i++) TestFunction(0,max,weights1,3,weights2,3,context);
		for(int i=0;i<0x1000;i++) TestFunction(max,max,weights1,3,weights2,3,context);
		for(int i=0;i<0x1000;i++) TestFunction(i%(max+1),max,weights1,3,weights2,3,context);
		for(int i=0;i<0x1000;i++)
		{
			uint32_t val=Hash32(i)%(max+1);
			TestFunction(val,max,weights1,3,weights2,3,context);
		}
		max*=2;
	}

	max=1;
	for(int e=0;e<32;e++)
	{
		for(int i=0;i<0x1000;i++) TestFunction(0,max-1,weights1,3,weights2,3,context);
		for(int i=0;i<0x1000;i++) TestFunction(max-1,max-1,weights1,3,weights2,3,context);
		for(int i=0;i<0x1000;i++) TestFunction(i%max,max-1,weights1,3,weights2,3,context);
		for(int i=0;i<0x1000;i++)
		{
			uint32_t val=Hash32(i)%max;
			TestFunction(val,max-1,weights1,3,weights2,3,context);
		}
		max*=2;
	}

	max=1;
	for(int e=0;e<9;e++)
	{
		for(int i=0;i<0x1000;i++) TestFunction(0,max,weights1,3,weights2,3,context);
		for(int i=0;i<0x1000;i++) TestFunction(max,max,weights1,3,weights2,3,context);
		for(int i=0;i<0x1000;i++) TestFunction(i%(max+1),max,weights1,3,weights2,3,context);
		for(int i=0;i<0x1000;i++)
		{
			uint32_t val=Hash32(i)%(max+1);
			TestFunction(val,max,weights1,3,weights2,3,context);
		}
		max*=10;
	}

	for(int i=0;i<0x10000;i++)
	{
		uint32_t max=Hash32(i)>>(Hash32(i+1)%32);
		uint32_t val=Hash32(i+70)%(max+1);
		TestFunction(val,max,weights1,3,weights2,3,context);
	}
}
コード例 #7
0
ファイル: Test3.c プロジェクト: miketwo/wilt-compressor
void Test3()
{
	printf("Running test set 3...\n");

	printf("Creating stream \"test3.data\" using universal code...\n");

	FILE *out=fopen("test3.data","wb");
	if(!out)
	{
		fprintf(stderr,"Couldn't create file \"test3.data\"\n");
		exit(1);
	}

	RangeEncoder encoder;
	InitializeRangeEncoder(&encoder,STDIOWriteFunction,out);

	int weights1[33],weights2[33];

	for(int i=0;i<33;i++) weights1[i]=weights2[i]=0x800;

	for(int i=0;i<0x1000;i++) WriteUniversalCode(&encoder,0,weights1,3,weights2,3);
	for(int i=0;i<0x1000;i++) WriteUniversalCode(&encoder,0xffffffff,weights1,3,weights2,3);
	for(int i=0;i<0x1000;i++) WriteUniversalCode(&encoder,i,weights1,3,weights2,3);
	for(int i=0;i<0x10000;i++)
	{
		uint32_t val=Hash32(i)>>(Hash32(i+1)%32);
		WriteUniversalCode(&encoder,val,weights1,3,weights2,3);
	}

	FinishRangeEncoder(&encoder);
	fclose(out);

	printf("Reading stream \"test3.data\"...\n");

	FILE *in=fopen("test3.data","rb");
	if(!in)
	{
		fprintf(stderr,"Couldn't read file \"test3.data\"\n");
		exit(1);
	}

	RangeDecoder decoder;
	InitializeRangeDecoder(&decoder,STDIOReadFunction,in);

	for(int i=0;i<33;i++) weights1[i]=weights2[i]=0x800;

	for(int i=0;i<0x1000;i++) assert(0==ReadUniversalCode(&decoder,weights1,3,weights2,3));
	for(int i=0;i<0x1000;i++) assert(0xffffffff==ReadUniversalCode(&decoder,weights1,3,weights2,3));
	for(int i=0;i<0x1000;i++) assert(i==ReadUniversalCode(&decoder,weights1,3,weights2,3));
	for(int i=0;i<0x10000;i++)
	{
		uint32_t val=Hash32(i)>>(Hash32(i+1)%32);
		assert(val==ReadUniversalCode(&decoder,weights1,3,weights2,3));
	}

	fclose(in);
}
コード例 #8
0
ファイル: sv_init.c プロジェクト: postfix/quake2vr
/*
================
SV_FindIndex

================
*/
int32_t SV_FindIndex (char *name, int32_t start, int32_t max, qboolean create)
{
	int32_t		i;
    hash32_t    hash;
	if (!name || !name[0])
		return 0;

    hash = Hash32(name, strlen(name));
	for (i = 1; i < max && sv.configstrings[start+i][0]; i++)
		if (!HashEquals32(hash, sv.confighashes[start+i]) && !strcmp(sv.configstrings[start+i], name))
			return i;

	if (!create)
		return 0;

	// Knightmare 12/23/2001
	// Output a more useful error message to tell user what overflowed
	// And don't bomb out, either- instead, return last possible index
	if (i == max)
	//	Com_Error (ERR_DROP, "*Index: overflow");
	{
		if (start == CS_MODELS)
			Com_Printf (S_COLOR_YELLOW"Warning: Index overflow for models\n");
		else if (start == CS_SOUNDS)
			Com_Printf (S_COLOR_YELLOW"Warning: Index overflow for sounds\n");
		else if (start == CS_IMAGES)
			Com_Printf (S_COLOR_YELLOW"Warning: Index overflow for images\n");
		return (max-1);	// return the last possible index
	}
	// end Knightmare

	strncpy (sv.configstrings[start+i], name, sizeof(sv.configstrings[i]));
    sv.confighashes[start + i] = Hash32(name, strlen(name));
    
	if (sv.state != ss_loading)
	{	// send the update to everyone
		SZ_Clear (&sv.multicast);
		MSG_WriteChar (&sv.multicast, svc_configstring);
		MSG_WriteShort (&sv.multicast, start+i);
		MSG_WriteString (&sv.multicast, name);
		SV_Multicast (vec3_origin, MULTICAST_ALL_R);
	}

	return i;
}
コード例 #9
0
ファイル: type.cpp プロジェクト: wh5a/xgill
TypeFunction::TypeFunction(Type *return_type, TypeCSU *csu_type, bool varargs,
                           const Vector<Type*> &argument_types)
  : Type(YK_Function),
    m_return_type(return_type), m_csu_type(csu_type), m_varargs(varargs),
    m_argument_types(argument_types.Data()),
    m_argument_count(argument_types.Size())
{
  Assert(m_return_type);
  AssertArray(m_argument_types, m_argument_count);

  if (m_varargs)
    m_hash++;
  m_hash = Hash32(m_hash, m_return_type->Hash());
  if (m_csu_type)
    m_hash = Hash32(m_hash, m_csu_type->Hash());
  for (size_t aind = 0; aind < m_argument_count; aind++)
    m_hash = Hash32(m_hash, m_argument_types[aind]->Hash());
}
コード例 #10
0
ファイル: GobBridge.cpp プロジェクト: Anters/LevelEditor
// ------------------------------------------------------------------------------------------------
ObjectTypeGUID GobBridge::GetTypeId(const char* typeName)
{
    ObjectTypeGUID tid = Hash32(typeName);
    auto it = m_createObjectFunctions.find(tid);
    if(it != m_createObjectFunctions.end())
    {
        return tid;
    }
    return 0;
}
コード例 #11
0
ファイル: type.cpp プロジェクト: wh5a/xgill
Field::Field(String *name, String *source_name, TypeCSU *csu_type,
             Type *type, bool is_function)
  : m_name(name), m_source_name(source_name),
    m_csu_type(csu_type), m_type(type), m_is_function(is_function)
{
  Assert(m_name);
  Assert(m_csu_type);
  Assert(m_type);

  m_hash = Hash32(m_csu_type->Hash(), m_name->Hash());
}
コード例 #12
0
ファイル: GobBridge.cpp プロジェクト: Anters/LevelEditor
// ------------------------------------------------------------------------------------------------
ObjectListUID GobBridge::GetChildListId(ObjectTypeGUID tid, const char* listName)
{
    ObjectListUID id = Hash32(listName);
    uint64_t pair = MakePair(tid, id);
    auto it = m_childListFunctions.find(pair);
    if(it != m_childListFunctions.end())
    {
        return id;
    }
    return 0;
}
コード例 #13
0
ファイル: GobBridge.cpp プロジェクト: Anters/LevelEditor
// ------------------------------------------------------------------------------------------------
ObjectPropertyUID GobBridge::GetPropertyId(ObjectTypeGUID tid, const char* propName)
{
    ObjectPropertyUID pid = Hash32(propName);
    uint64_t tidpid = MakePair(tid, pid);
    auto it = m_propertyFunctions.find(tidpid);
    if(it != m_propertyFunctions.end())
    {
        return pid;
    }
    return 0;
}
コード例 #14
0
ファイル: RenderCore.cpp プロジェクト: jayryness/Eigen
    inline const RenderPort* RenderSystem::Core::GetPort(const char* name)
    {
        int nameLength = (int) strlen(name);

        // Find the port

        unsigned key = Hash32(name, nameLength);
        unsigned slot = key & cRenderPortKeyMask;
        while (m_portKeys[slot] != 0)
        {
            if (m_portKeys[slot] == key)
            {
                RenderPort* renderPort = m_ports + m_portIndices[slot];
                return renderPort;
            }

            slot = (slot+1) & cRenderPortKeyMask;
        }

        // It's not in the table - can we add it?

        if (m_portsCount == cMaxRenderPorts)
            return nullptr;

        // Reserve space in string table and copy name

        if (m_stringsEnd + nameLength + 1 > m_stringsCapacity)
        {
            m_stringsCapacity = (m_stringsEnd + nameLength + 1) * 2;
            char* strings = Memory::Allocate<char>(m_stringsCapacity);
            memcpy(strings, m_strings, m_stringsEnd);
            Memory::Free(m_strings);
            m_strings = strings;
        }
        memcpy(m_strings + m_stringsEnd, name, nameLength + 1);

        // Populate the slot with the new port

        m_portKeys[slot] = key;
        m_portIndices[slot] = m_portsCount;

        RenderPort* renderPort = m_ports + m_portsCount;
        renderPort->name = m_strings + m_stringsEnd;
        renderPort->index = m_portsCount;

        m_stringsEnd += nameLength + 1;
        m_portsCount++;

        return renderPort;
    }
コード例 #15
0
ファイル: g_save.c プロジェクト: PBrookfield/mpgamex86
/*
 * Helper function to get the
 * pointer to a function by
 * it's human readable name.
 * Called by WriteField1 and
 * WriteField2.
 */
byte *
FindFunctionByName(char *name)
{
    int i;
#ifdef Q2VR_ENGINE_MOD
    hash32_t nameHash = Hash32(name, strlen(name));
#endif
    for (i = 0; functionList[i].funcStr; i++)
    {
#ifdef Q2VR_ENGINE_MOD
        if (!HashCompare32(nameHash, functionList[i].funcHash) && !strcmp(name, functionList[i].funcStr))
#else
            if (!strcmp(name, functionList[i].funcStr))
#endif
            {
                return functionList[i].funcPtr;
            }
    }
    
    return NULL;
}
コード例 #16
0
ファイル: g_save.c プロジェクト: PBrookfield/mpgamex86
/*
 * Helper function to get the
 * pointer to a mmove_t struct
 * by a human readable definition.
 */
mmove_t *
FindMmoveByName(char *name)
{
    int i;
#ifdef Q2VR_ENGINE_MOD
    hash32_t nameHash = Hash32(name, strlen(name));
#endif
    for (i = 0; mmoveList[i].mmoveStr; i++)
    {
#ifdef Q2VR_ENGINE_MOD
        if (!HashCompare32(nameHash, mmoveList[i].mmoveHash) && !strcmp(name, mmoveList[i].mmoveStr))
#else
            if (!strcmp(name, mmoveList[i].mmoveStr))
#endif
            {
                return mmoveList[i].mmovePtr;
            }
    }
    
    return NULL;
}
コード例 #17
0
ファイル: sv_main.c プロジェクト: postfix/quake2vr
/*
=================
SV_UserinfoChanged

Pull specific info from a newly changed userinfo string
into a more C freindly form.
=================
*/
void SV_UserinfoChanged (client_t *cl)
{
    char	*val;
    int32_t		i;

    // call prog code to allow overrides
    ge->ClientUserinfoChanged (cl->edict, cl->userinfo);

    // name for C code
    strncpy (cl->name, Info_ValueForKey (cl->userinfo, "name"), sizeof(cl->name)-1);
    // mask off high bit
    for (i=0 ; i<sizeof(cl->name) ; i++)
        cl->name[i] &= 127;
    cl->nameHash = Hash32(cl->name, strlen(cl->name));
    // rate command
    val = Info_ValueForKey (cl->userinfo, "rate");
    if (strlen(val))
    {
        i = atoi(val);
        cl->rate = i;
        if (cl->rate < 100)
            cl->rate = 100;
        if (cl->rate > 15000)
            cl->rate = 15000;
    }
    else
        cl->rate = 5000;

    // msg command
    val = Info_ValueForKey (cl->userinfo, "msg");
    if (strlen(val))
    {
        cl->messagelevel = atoi(val);
    }

}
コード例 #18
0
ファイル: g_save.c プロジェクト: PBrookfield/mpgamex86
/*
 * This will be called when the dll is first loaded,
 * which only happens when a new game is started or
 * a save game is loaded.
 */
void InitGame (void)
{
	gi.dprintf ("\n==== InitGame ====\n");
    
#ifdef Q2VR_ENGINE_MOD
    {
        int i;
        gi.dprintf("Initializing hash tables...");
        
        for (i = 0; mmoveList[i].mmoveStr; i++)
        {
            mmoveList[i].mmoveHash = Hash32(mmoveList[i].mmoveStr, strlen(mmoveList[i].mmoveStr));
        }
        
        for (i = 0; functionList[i].funcStr; i++)
        {
            functionList[i].funcHash = Hash32(functionList[i].funcStr, strlen(functionList[i].funcStr));
        }
        
        gi.dprintf(" Done!\n");
    }
#endif
    
    gi.dprintf("Sorting tables...");
    
    funcListSize = sizeof(functionList) / sizeof(functionList[0]) - 1;
    qsort(functionList,funcListSize, sizeof(functionList[0]), funcsort);
    
    mmoveListSize = (sizeof(mmoveList) / sizeof(mmoveList[0])) - 1;
    qsort(mmoveList,mmoveListSize, sizeof(mmoveList[0]), mmovesort);
    
    gi.dprintf(" Done!\n");
    
//Knightmare
	lithium_defaults();
	gun_x = gi.cvar ("gun_x", "0", 0);
	gun_y = gi.cvar ("gun_y", "0", 0);
	gun_z = gi.cvar ("gun_z", "0", 0);

	//FIXME: sv_ prefix is wrong for these
	sv_rollspeed = gi.cvar ("sv_rollspeed", "200", 0);
	sv_rollangle = gi.cvar ("sv_rollangle", "2", 0);
	sv_maxvelocity = gi.cvar ("sv_maxvelocity", "2000", 0);
	sv_gravity = gi.cvar ("sv_gravity", "800", 0);

	sv_stopspeed = gi.cvar ("sv_stopspeed", "100", 0);		// PGM - was #define in g_phys.c

//ROGUE
	g_showlogic = gi.cvar ("g_showlogic", "0", 0);
	huntercam = gi.cvar ("huntercam", "1", CVAR_SERVERINFO|CVAR_LATCH);
	strong_mines = gi.cvar ("strong_mines", "0", 0);
	randomrespawn = gi.cvar ("randomrespawn", "0", 0);
//ROGUE

	// noset vars
	dedicated = gi.cvar ("dedicated", "0", CVAR_NOSET);

	// latched vars
	sv_cheats = gi.cvar ("cheats", "0", CVAR_SERVERINFO|CVAR_LATCH);
	gi.cvar ("gamename", GAMEVERSION , CVAR_SERVERINFO | CVAR_LATCH);
	gi.cvar ("gamedate", __DATE__ , CVAR_SERVERINFO | CVAR_LATCH);
	gamedir = gi.cvar("gamedir","",CVAR_SERVERINFO | CVAR_LATCH);

	maxclients = gi.cvar ("maxclients", "4", CVAR_SERVERINFO | CVAR_LATCH);
	maxspectators = gi.cvar ("maxspectators", "4", CVAR_SERVERINFO);
	deathmatch = gi.cvar ("deathmatch", "0", CVAR_LATCH);
	coop = gi.cvar ("coop", "0", CVAR_LATCH);
	skill = gi.cvar ("skill", "1", CVAR_LATCH);

	//Knightmare- increase maxentities
	//maxentities = gi.cvar ("maxentities", "1024", CVAR_LATCH);
	maxentities = gi.cvar ("maxentities", va("%i",MAX_EDICTS), CVAR_LATCH);
	gamerules = gi.cvar ("gamerules", "0", CVAR_LATCH);			//PGM

	// change anytime vars
	dmflags = gi.cvar ("dmflags", "0", CVAR_SERVERINFO);
	fraglimit = gi.cvar ("fraglimit", "0", CVAR_SERVERINFO);
	timelimit = gi.cvar ("timelimit", "0", CVAR_SERVERINFO);
	password = gi.cvar ("password", "", CVAR_USERINFO);
	spectator_password = gi.cvar ("spectator_password", "", CVAR_USERINFO);
	filterban = gi.cvar ("filterban", "1", 0);

	g_select_empty = gi.cvar ("g_select_empty", "0", CVAR_ARCHIVE);

	run_pitch = gi.cvar ("run_pitch", "0.002", 0);
	run_roll = gi.cvar ("run_roll", "0.005", 0);
	bob_up  = gi.cvar ("bob_up", "0.005", 0);
	bob_pitch = gi.cvar ("bob_pitch", "0.002", 0);
	bob_roll = gi.cvar ("bob_roll", "0.002", 0);

	// flood control
	flood_msgs = gi.cvar ("flood_msgs", "4", 0);
	flood_persecond = gi.cvar ("flood_persecond", "4", 0);
	flood_waitdelay = gi.cvar ("flood_waitdelay", "10", 0);

	// dm map list
	sv_maplist = gi.cvar ("sv_maplist", "", 0);

	// Lazarus
	actorchicken = gi.cvar("actorchicken", "1", CVAR_SERVERINFO|CVAR_LATCH);
	actorjump = gi.cvar("actorjump", "1", CVAR_SERVERINFO|CVAR_LATCH);
	actorscram = gi.cvar("actorscram", "1", CVAR_SERVERINFO|CVAR_LATCH);
	alert_sounds = gi.cvar("alert_sounds", "0", CVAR_ARCHIVE);
	allow_fog = gi.cvar ("allow_fog", "1", CVAR_ARCHIVE);

	// set to 0 to bypass target_changelevel clear inventory flag
	// because some user maps have this erroneously set
	allow_clear_inventory = gi.cvar ("allow_clear_inventory", "1", CVAR_ARCHIVE);

	cd_loopcount = gi.cvar("cd_loopcount","4",0);
	cl_gun = gi.cvar("cl_gun", "1", 0);
	cl_thirdperson = gi.cvar(CLIENT_THIRDPERSON_CVAR, "0", 0); // Knightmare added
	corpse_fade = gi.cvar("corpse_fade", "0", CVAR_ARCHIVE);
	corpse_fadetime = gi.cvar("corpse_fadetime", "20", CVAR_ARCHIVE);
	crosshair = gi.cvar("crosshair", "1", 0);
	footstep_sounds = gi.cvar("footstep_sounds", "0", CVAR_SERVERINFO|CVAR_LATCH);
	fov = gi.cvar("fov", "90", 0);
	hand = gi.cvar("hand", "0", 0);
	jetpack_weenie = gi.cvar("jetpack_weenie", "0", CVAR_SERVERINFO);
	joy_pitchsensitivity = gi.cvar("joy_pitchsensitivity", "1", 0);
	joy_yawsensitivity = gi.cvar("joy_yawsensitivity", "-1", 0);
	jump_kick = gi.cvar("jump_kick", "0", CVAR_SERVERINFO|CVAR_LATCH);
	lights = gi.cvar("lights", "1", 0);
	lightsmin = gi.cvar("lightsmin", "a", CVAR_SERVERINFO);
	m_pitch = gi.cvar("m_pitch", "0.022", 0);
	m_yaw = gi.cvar("m_yaw", "0.022", 0);
	monsterjump = gi.cvar("monsterjump", "1", CVAR_SERVERINFO|CVAR_LATCH);
	rocket_strafe = gi.cvar("rocket_strafe", "0", 0);
#ifdef KMQUAKE2_ENGINE_MOD
	sv_maxgibs = gi.cvar("sv_maxgibs", "160", CVAR_SERVERINFO);
#else
	sv_maxgibs = gi.cvar("sv_maxgibs", "20", CVAR_SERVERINFO);
#endif
	turn_rider = gi.cvar("turn_rider", "1", CVAR_SERVERINFO);
	zoomrate = gi.cvar("zoomrate", "80", CVAR_ARCHIVE);
	zoomsnap = gi.cvar("zoomsnap", "20", CVAR_ARCHIVE);

	// shift_ and rotate_distance only used for debugging stuff - this is the distance
	// an entity will be moved by "item_left", "item_right", etc.
	shift_distance = gi.cvar("shift_distance", "1", CVAR_SERVERINFO);
	rotate_distance = gi.cvar("rotate_distance", "1", CVAR_SERVERINFO);

	// GL stuff
	gl_clear = gi.cvar("gl_clear", "0", 0);

	// Lazarus saved cvars that we may or may not manipulate, but need to
	// restore to original values upon map exit.
	lazarus_cd_loop = gi.cvar("lazarus_cd_loop", "0", 0);
	lazarus_gl_clear= gi.cvar("lazarus_gl_clear","0", 0);
	lazarus_pitch   = gi.cvar("lazarus_pitch",   "0", 0);
	lazarus_yaw     = gi.cvar("lazarus_yaw",     "0", 0);
	lazarus_joyp    = gi.cvar("lazarus_joyp",    "0", 0);
	lazarus_joyy    = gi.cvar("lazarus_joyy",    "0", 0);
	lazarus_cl_gun  = gi.cvar("lazarus_cl_gun",  "0", 0);
	lazarus_crosshair = gi.cvar("lazarus_crosshair", "0", 0);

	/*if(lazarus_gl_clear->value)
		gi.cvar_forceset("gl_clear",         va("%d",lazarus_gl_clear->value));
	else
		gi.cvar_forceset("lazarus_gl_clear", va("%d",gl_clear->value));*/

	if(!deathmatch->value && !coop->value)
	{
		/*if(lazarus_pitch->value)
		{
			gi.cvar_forceset("cd_loopcount",         va("%d",(int)(lazarus_cd_loop->value)));
#ifndef KMQUAKE2_ENGINE_MOD // engine has zoom autosensitivity
			gi.cvar_forceset("m_pitch",              va("%f",lazarus_pitch->value));
			gi.cvar_forceset("m_yaw",                va("%f",lazarus_yaw->value));
#endif
			//gi.cvar_forceset("cl_gun",               va("%d",(int)(lazarus_cl_gun->value)));
			//gi.cvar_forceset("crosshair",            va("%d",(int)(lazarus_crosshair->value)));
		}
		else
		{*/
			gi.cvar_forceset("lazarus_cd_loop",        va("%d",(int)(cd_loopcount->value)));
#ifndef KMQUAKE2_ENGINE_MOD // engine has zoom autosensitivity
			gi.cvar_forceset("lazarus_pitch",          va("%f",m_pitch->value));
			gi.cvar_forceset("lazarus_yaw",            va("%f",m_yaw->value));
			gi.cvar_forceset("lazarus_joyp",           va("%f",joy_pitchsensitivity->value));
			gi.cvar_forceset("lazarus_joyy",           va("%f",joy_yawsensitivity->value));
#endif
			gi.cvar_forceset("lazarus_cl_gun",         va("%d",(int)(cl_gun->value)));
			gi.cvar_forceset("lazarus_crosshair",      va("%d",(int)(crosshair->value)));
		//}
	}

	tpp = gi.cvar ("tpp", "0", CVAR_ARCHIVE);
	tpp_auto = gi.cvar ("tpp_auto", "1", 0);
	crossh = gi.cvar ("crossh", "1", 0);
	allow_download = gi.cvar("allow_download", "0", 0);

	// If this is an SP game and "readout" is not set, force allow_download off
	// so we don't get the annoying "Refusing to download path with .." messages
	// due to misc_actor sounds.
	if(allow_download->value && !readout->value && !deathmatch->value)
		gi.cvar_forceset("allow_download", "0");

	bounce_bounce = gi.cvar("bounce_bounce", "0.5", 0);
	bounce_minv   = gi.cvar("bounce_minv",   "60",  0);

	// items
	InitItems ();

	Com_sprintf (game.helpmessage1, sizeof(game.helpmessage1), "");

	Com_sprintf (game.helpmessage2, sizeof(game.helpmessage2), "");

	// initialize all entities for this game
	game.maxentities = maxentities->value;
	g_edicts =  gi.TagMalloc (game.maxentities * sizeof(g_edicts[0]), TAG_GAME);
	globals.edicts = g_edicts;
	globals.max_edicts = game.maxentities;

	// initialize all clients for this game
	game.maxclients = maxclients->value;
    g_clients = gi.TagMalloc (game.maxclients * sizeof(game.clients[0]), TAG_GAME);
    game.clients = g_clients;
    globals.num_edicts = game.maxclients+1;

//======
//ROGUE
	if(gamerules)
	{
		InitGameRules();	// if there are game rules to set up, do so now.
	}
//ROGUE
//======

}
コード例 #19
0
Location::Location(String *filename, uint32_t line)
  : m_filename(filename), m_line(line)
{
  m_hash = Hash32(m_filename->Hash(), m_line);
}
コード例 #20
0
ファイル: sv_init.c プロジェクト: postfix/quake2vr
/*
================
SV_SpawnServer

Change the server to a new map, taking all connected
clients along with it.

================
*/
void SV_SpawnServer (char *server, char *spawnpoint, server_state_t serverstate, qboolean attractloop, qboolean loadgame)
{
	int32_t			i;
	uint32_t	checksum;
	fileHandle_t	f;

	if (attractloop)
		Cvar_Set ("paused", "0");

	Com_Printf ("\n------- Server Initialization -------\n");

	Com_DPrintf ("SpawnServer: %s\n",server);
	if (sv.demofile)
		FS_FCloseFile (sv.demofile);

	svs.spawncount++;		// any partially connected client will be
							// restarted
	sv.state = ss_dead;
	Com_SetServerState (sv.state);

	// wipe the entire per-level structure
	memset (&sv, 0, sizeof(sv));
	svs.realtime = 0;
	sv.loadgame = loadgame;
	sv.attractloop = attractloop;

	// save name for levels that don't set message
	strcpy (sv.configstrings[CS_NAME], server);
    sv.confighashes[CS_NAME] = Hash32(server, strlen(server));
    
	if (Cvar_VariableValue ("deathmatch"))
	{
		sprintf(sv.configstrings[CS_AIRACCEL], "%g", sv_airaccelerate->value);
		pm_airaccelerate = sv_airaccelerate->value;
	}
	else
	{
		strcpy(sv.configstrings[CS_AIRACCEL], "0");
		pm_airaccelerate = 0;
	}
    sv.confighashes[CS_AIRACCEL] = Hash32(sv.configstrings[CS_AIRACCEL], strlen(sv.configstrings[CS_AIRACCEL]));


	SZ_Init (&sv.multicast, sv.multicast_buf, sizeof(sv.multicast_buf));

	strcpy (sv.name, server);

	// leave slots at start for clients only
	for (i=0 ; i<maxclients->value ; i++)
	{
		// needs to reconnect
		if (svs.clients[i].state > cs_connected)
			svs.clients[i].state = cs_connected;
		svs.clients[i].lastframe = -1;
	}

	sv.time = 1000;

    // this has already been done?
    
    
	if (serverstate != ss_game)
	{
		sv.models[1] = CM_LoadMap ("", false, &checksum);	// no real map
	}
	else
	{
		Com_sprintf (sv.configstrings[CS_MODELS+1],sizeof(sv.configstrings[CS_MODELS+1]),
			"maps/%s.bsp", server);
        sv.confighashes[CS_MODELS+1] = Hash32(sv.configstrings[CS_MODELS+1], strlen(sv.configstrings[CS_MODELS+1]));

		// resolve CS_PAKFILE, hack by Jay Dolan
		FS_FOpenFile(sv.configstrings[CS_MODELS + 1], &f, FS_READ);
		strcpy(sv.configstrings[CS_PAKFILE], (last_pk3_name ? last_pk3_name : ""));
		FS_FCloseFile(f);
        sv.confighashes[CS_PAKFILE] = Hash32(sv.configstrings[CS_PAKFILE], strlen(sv.configstrings[CS_PAKFILE]));
		sv.models[1] = CM_LoadMap (sv.configstrings[CS_MODELS+1], false, &checksum);
	}
	Com_sprintf (sv.configstrings[CS_MAPCHECKSUM],sizeof(sv.configstrings[CS_MAPCHECKSUM]),
		"%i", checksum);
    sv.confighashes[CS_MAPCHECKSUM] = Hash32(sv.configstrings[CS_MAPCHECKSUM], strlen(sv.configstrings[CS_MAPCHECKSUM]));
	//
	// clear physics interaction links
	//
	SV_ClearWorld ();
	
	for (i=1 ; i< CM_NumInlineModels() ; i++)
	{
		Com_sprintf (sv.configstrings[CS_MODELS+1+i], sizeof(sv.configstrings[CS_MODELS+1+i]),
			"*%i", i);
        sv.confighashes[CS_MODELS+1+i] = Hash32(sv.configstrings[CS_MODELS+1+i], strlen(sv.configstrings[CS_MODELS+1+i]));
		sv.models[i+1] = CM_InlineModel (sv.configstrings[CS_MODELS+1+i]);
	}

	//
	// spawn the rest of the entities on the map
	//	

	// precache and static commands can be issued during
	// map initialization
	sv.state = ss_loading;
	Com_SetServerState (sv.state);

	// load and spawn all other entities
	ge->SpawnEntities ( sv.name, CM_EntityString(), spawnpoint );

	// run two frames to allow everything to settle
	ge->RunFrame ();
	ge->RunFrame ();

	// all precaches are complete
	sv.state = serverstate;
	Com_SetServerState (sv.state);
	
	// create a baseline for more efficient communications
	SV_CreateBaseline ();

	// check for a savegame
	SV_CheckForSavegame ();

	// set serverinfo variable
	Cvar_FullSet ("mapname", sv.name, CVAR_SERVERINFO | CVAR_NOSET);

	Com_Printf ("-------------------------------------\n");
}
コード例 #21
0
ファイル: type.cpp プロジェクト: wh5a/xgill
TypeCSU::TypeCSU(String *csu_name)
  : Type(YK_CSU), m_csu_name(csu_name)
{
  Assert(m_csu_name);
  m_hash = Hash32(m_hash, m_csu_name->Hash());
}
コード例 #22
0
ファイル: type.cpp プロジェクト: wh5a/xgill
TypeInt::TypeInt(size_t width, bool sign)
  : Type(YK_Int), m_width(width), m_sign(sign)
{
  m_hash = Hash32(m_hash, m_width * 2 + (m_sign ? 1 : 0));
}
コード例 #23
0
ファイル: type.cpp プロジェクト: wh5a/xgill
TypeFloat::TypeFloat(size_t width)
  : Type(YK_Float), m_width(width)
{
  m_hash = Hash32(m_hash, m_width);
}
コード例 #24
0
ファイル: Event.hpp プロジェクト: nilspin/RadixEngine
 constexpr static EventType TypeNameHash(StaticEventTypeName etn) {
   return (EventType) Hash32(etn);
 }
コード例 #25
0
ファイル: GobBridge.cpp プロジェクト: Anters/LevelEditor
// ------------------------------------------------------------------------------------------------
void GobBridge::RegisterObject(const char * typeName, ObjectCreatorFncPtr func)
{
    ObjectTypeGUID tid = Hash32(typeName);
    assert(m_createObjectFunctions.find(tid) == m_createObjectFunctions.end()); // double registration.
    m_createObjectFunctions[tid] = func;
}