コード例 #1
0
//
// I_SetAffinityMask
//
// Due to ongoing problems with the SDL_mixer library and/or the SDL audio
// core, it is necessary to support the restriction of Eternity to a single
// core or CPU. Apparent thread contention issues cause the library to 
// malfunction if multiple threads of the process run simultaneously.
//
// I wish SDL would fix their bullshit already.
//
void I_SetAffinityMask(void)
{
#ifdef HAVE_SCHED_SETAFFINITY
   int p = M_CheckParm("-affinity");

   if(p && p < myargc - 1)
       process_affinity_mask = datoi(myargv[p + 1]);
   else
       process_affinity_mask = 0;

   // Set the process affinity mask so that all threads
   // run on the same processor.  This is a workaround for a bug in
   // SDL_mixer that causes occasional crashes.
   if(process_affinity_mask)
   {
      int i;
      cpu_set_t set;

      CPU_ZERO(&set);
      
      for(i = 0; i < 16; ++i)
         CPU_SET((process_affinity_mask>>i)&1, &set);

      if(sched_setaffinity(getpid(), sizeof(set), &set) == -1)
         I_Printf("I_SetAffinityMask: failed to set process affinity mask.\n");
      else
         I_Printf("I_SetAffinityMask: applied affinity mask.\n");
   }
#endif
}
コード例 #2
0
ファイル: m_cheat.c プロジェクト: MP2E/kexplus
void M_CheatGiveWeapon(player_t * player, char dat[4])
{
	char c = dat[0];
	int w = datoi(&c);

	static char *WeapGotNames[8] = {
		GOTCHAINSAW,
		GOTSHOTGUN,
		GOTSHOTGUN2,
		GOTCHAINGUN,
		GOTLAUNCHER,
		GOTPLASMA,
		GOTBFG9000,
		GOTLASER
	};

	static weapontype_t WeapTypes[8] = {
		wp_chainsaw,
		wp_shotgun,
		wp_supershotgun,
		wp_chaingun,
		wp_missile,
		wp_plasma,
		wp_bfg,
		wp_laser
	};

	if (!w || w >= 9)
		return;

	if (!P_GiveWeapon(player, NULL, WeapTypes[w - 1], false))
		return;

	player->message = WeapGotNames[w - 1];
}
コード例 #3
0
ファイル: g_game.c プロジェクト: ProfessorKaos64/Doom64EX
static CMD(TriggerSpecial) {
    line_t junk;

    if(gamestate != GS_LEVEL) {
        return;
    }

    if(!param[0]) {
        return;
    }

    dmemset(&junk, 0, sizeof(line_t));
    junk.special = datoi(param[0]);
    junk.tag = datoi(param[1]);

    P_DoSpecialLine(players[consoleplayer].mo, &junk, 0);
}
コード例 #4
0
ファイル: m_cheat.c プロジェクト: MP2E/kexplus
void M_CheatGiveKey(player_t * player, char dat[4])
{
	char c = dat[0];
	int k = datoi(&c);

	if (!k || k > NUMCARDS)
		return;

	player->cards[k - 1] ^= 1;
	player->message = player->cards[k - 1] ? "Key Added" : "Key Removed";
}
コード例 #5
0
ファイル: g_game.c プロジェクト: ProfessorKaos64/Doom64EX
static CMD(ExitLevel) {
    if(gamestate != GS_LEVEL) {
        return;
    }

    if(demoplayback) {
        return;
    }

    if(!param[0]) {
        G_ExitLevel();
    }
    else {
        G_SecretExitLevel(datoi(param[0]));
    }
}
コード例 #6
0
ファイル: m_cheat.c プロジェクト: MP2E/kexplus
static void M_CheatWarp(player_t * player, char dat[4])
{
	int map;
	map = datoi(dat);

	if (map < 1)
		return;

	if (map > 33)
		return;

	// So be it.
	gameaction = ga_warpquick;
	gameskill = (int)sv_skill.value;
	gamemap = nextmap = map;
	dmemset(passwordData, 0xff, 16);
}
コード例 #7
0
ファイル: g_game.c プロジェクト: ProfessorKaos64/Doom64EX
static CMD(Weapon) {
    playercontrols_t *pc;
    int id;

    if(!(param[0])) {
        return;
    }

    id = datoi(param[0]);

    if((id > NUMWEAPONS) || (id < 1)) {
        return;
    }

    pc = &Controls;
    pc->nextweapon = id - 1;
}
コード例 #8
0
ファイル: m_cheat.c プロジェクト: MP2E/kexplus
void M_CheatArtifacts(player_t * player, char dat[4])
{
	char c = dat[0];
	int a = datoi(&c);

	static char *ArtiGotNames[3] = {
		GOTARTIFACT1,
		GOTARTIFACT2,
		GOTARTIFACT3
	};

	if (!a || a > 3)
		return;

	a = a - 1;

	player->artifacts |= (1 << a);
	player->message = ArtiGotNames[a];
}
コード例 #9
0
ファイル: g_game.c プロジェクト: ProfessorKaos64/Doom64EX
static CMD(SpawnThing) {
    int id = 0;
    player_t *player;
    mobj_t *thing;
    fixed_t x, y, z;

    if(gamestate != GS_LEVEL) {
        return;
    }

    if(!param[0]) {
        return;
    }

    if(netgame) {
        return;
    }

    id = datoi(param[0]);
    if(id >= NUMMOBJTYPES || id < 0) {
        return;
    }

    player = &players[consoleplayer];
    x = player->mo->x + FixedMul(INT2F(64) + mobjinfo[id].radius, dcos(player->mo->angle));
    y = player->mo->y + FixedMul(INT2F(64) + mobjinfo[id].radius, dsin(player->mo->angle));
    z = player->mo->z;

    thing = P_SpawnMobj(x, y, z, id);

    if(thing->info->spawnstate == S_000) {
        P_RemoveMobj(thing);
        return;
    }

    thing->angle = player->mo->angle;
}