コード例 #1
0
ファイル: am_map.c プロジェクト: fragglet/mbf
//
// AM_Stop()
//
// Cease automap operations, unload patches, notify status bar
//
// Passed nothing, returns nothing
//
void AM_Stop (void)
{
  static event_t st_notify = { 0, ev_keyup, AM_MSGEXITED };

  AM_unloadPics();
  automapactive = false;
  ST_Responder(&st_notify);
  stopped = true;
}
コード例 #2
0
ファイル: d_main.c プロジェクト: jezze/doom
void D_PostEvent(event_t *ev)
{

    if (gametic < 3)
        return;

    M_Responder(ev) || (gamestate == GS_LEVEL && (HU_Responder(ev) || ST_Responder(ev))) || G_Responder(ev);

}
コード例 #3
0
ファイル: d_main.c プロジェクト: Nekrofage/DoomRPi
void D_PostEvent(event_t *ev)
{
  /* cph - suppress all input events at game start
   * FIXME: This is a lousy kludge */
  if (gametic < 3) return;
  M_Responder(ev) ||
	  (gamestate == GS_LEVEL && (
				     HU_Responder(ev) ||
				     ST_Responder(ev) ||
				     AM_Responder(ev)
				     )
	  ) ||
	G_Responder(ev);
}
コード例 #4
0
ファイル: am_map.c プロジェクト: fragglet/mbf
//
// AM_initVariables()
//
// Initialize the variables for the automap
//
// Affects the automap global variables
// Status bar is notified that the automap has been entered
// Passed nothing, returns nothing
//
void AM_initVariables(void)
{
  int pnum;
  static event_t st_notify = { ev_keyup, AM_MSGENTERED };

  automapactive = true;
  fb = screens[0];

  f_oldloc.x = MAXINT;
  amclock = 0;
  lightlev = 0;

  m_paninc.x = m_paninc.y = 0;
  ftom_zoommul = FRACUNIT;
  mtof_zoommul = FRACUNIT;

  m_w = FTOM(f_w);
  m_h = FTOM(f_h);

  // find player to center on initially
  if (!playeringame[pnum = consoleplayer])
  for (pnum=0;pnum<MAXPLAYERS;pnum++)
    if (playeringame[pnum])
  break;

  plr = &players[pnum];
  m_x = plr->mo->x - m_w/2;
  m_y = plr->mo->y - m_h/2;
  AM_changeWindowLoc();

  // for saving & restoring
  old_m_x = m_x;
  old_m_y = m_y;
  old_m_w = m_w;
  old_m_h = m_h;

  // inform the status bar of the change
  ST_Responder(&st_notify);
}
コード例 #5
0
ファイル: g_game.cpp プロジェクト: JohnnyonFlame/odamex
//
// G_Responder
// Get info needed to make ticcmd_ts for the players.
//
BOOL G_Responder (event_t *ev)
{
	// any other key pops up menu if in demos
	// [RH] But only if the key isn't bound to a "special" command
	if (gameaction == ga_nothing &&
		(demoplayback || gamestate == GS_DEMOSCREEN))
	{
		const char *cmd = C_GetBinding (ev->data1);

		if (ev->type == ev_keydown)
		{

			if (!cmd || (
				strnicmp (cmd, "menu_", 5) &&
				stricmp (cmd, "toggleconsole") &&
				stricmp (cmd, "sizeup") &&
				stricmp (cmd, "sizedown") &&
				stricmp (cmd, "togglemap") &&
				stricmp (cmd, "spynext") &&
				stricmp (cmd, "chase") &&
				stricmp (cmd, "+showscores") &&
				stricmp (cmd, "bumpgamma") &&
				stricmp (cmd, "screenshot")))
			{
				S_Sound (CHAN_VOICE, "switches/normbutn", 1, ATTN_NONE);
				M_StartControlPanel ();
				return true;
			}
			else
			{
				return C_DoKey (ev);
			}
		}
		if (cmd && cmd[0] == '+')
			return C_DoKey (ev);

		return false;
	}

	if (gamestate == GS_LEVEL || gamestate == GS_INTERMISSION)
	{
		if (HU_Responder (ev))
			return true;		// chat ate the event
		if (ST_Responder (ev))
			return true;		// status window ate it
		if (!viewactive)
			if (AM_Responder (ev))
				return true;	// automap ate it
	}
	else if (gamestate == GS_FINALE)
	{
		if (F_Responder (ev))
			return true;		// finale ate the event
	}

	switch (ev->type)
	{
	  case ev_keydown:
		if (C_DoKey (ev))
			return true;
		break;

	  case ev_keyup:
		C_DoKey (ev);
		break;

	  // [Toke - Mouse] New mouse code
	  case ev_mouse:
		zdoomsens = (float)(mouse_sensitivity / 10);

		if (mouse_type == 0)
		{
			if (dynres_state == 0)
			{
				mousex = ev->data2 * (mouse_sensitivity + 5) / 10; // [Toke - Mouse] Marriage of origonal and zdoom mouse code, functions like doom2.exe code
				mousey = ev->data3 * (mouse_sensitivity + 5) / 10;
			}
			else if (dynres_state == 1)
			{
				mousexleft = ev->data2;
				mousexleft = -mousexleft;
				mousex = pow((ev->data2 * (mouse_sensitivity + 5) / 10), dynresval);

				if (ev->data2 < 0)
				{
					mousexleft = pow((mousexleft * (mouse_sensitivity + 5) / 10), dynresval);
					mousex = -mousexleft;
				}

				mouseydown = ev->data3;
				mouseydown = -mouseydown;
				mousey = pow((ev->data3 * (mouse_sensitivity + 5) / 10), dynresval);

				if (ev->data3 < 0)
				{
					mouseydown = pow((mouseydown * (mouse_sensitivity + 5) / 10), dynresval);
					mousey = -mouseydown;
				}
			}
		}
		else if (mouse_type == 1)
		{
			if (dynres_state == 0)
			{
				mousex = ev->data2 * (zdoomsens); // [Toke - Mouse] Zdoom mouse code
				mousey = ev->data3 * (zdoomsens);
			}
			else if (dynres_state == 1)
			{
				mousexleft = ev->data2;
				mousexleft = -mousexleft;
				mousex = pow((ev->data2 * (zdoomsens)), dynresval);

				if (ev->data2 < 0)
				{
					mousexleft = pow((mousexleft * (zdoomsens)), dynresval);
					mousex = -mousexleft;
				}

				mouseydown = ev->data3;
				mouseydown = -mouseydown;
				mousey = pow((ev->data3 * (zdoomsens)), dynresval);

				if (ev->data3 < 0)
				{
					mouseydown = pow((mouseydown * (zdoomsens)), dynresval);
					mousey = -mouseydown;
				}
			}
		}

		if (displaymouse == 1)
			Printf(PRINT_MEDIUM, "(%d %d) ", mousex, mousey);

		break;

	  case ev_joystick:
		joyxmove = ev->data2;
		joyymove = ev->data3;
		break;

	}

	// [RH] If the view is active, give the automap a chance at
	// the events *last* so that any bound keys get precedence.

	if (gamestate == GS_LEVEL && viewactive)
		return AM_Responder (ev);

	if (ev->type == ev_keydown ||
		ev->type == ev_mouse ||
		ev->type == ev_joystick)
		return true;
	else
		return false;
}
コード例 #6
0
ファイル: g_game.c プロジェクト: ProfessorKaos64/Doom64EX
dboolean G_Responder(event_t* ev) {
    // Handle level specific ticcmds
    if(gamestate == GS_LEVEL) {
        // allow spy mode changes even during the demo
        if(ev->type == ev_keydown
                && ev->data1 == KEY_F12 && (singledemo || !deathmatch)) {
            // spy mode
            do {
                displayplayer++;
                if(displayplayer == MAXPLAYERS) {
                    displayplayer = 0;
                }

            }
            while(!playeringame[displayplayer] && displayplayer != consoleplayer);

            return true;
        }

        if(demoplayback && gameaction == ga_nothing) {
            if(ev->type == ev_keydown ||
                    ev->type == ev_gamepad) {
                G_CheckDemoStatus();
                gameaction = ga_warpquick;
                return true;
            }
            else {
                return false;
            }
        }

        if(ST_Responder(ev)) {
            return true;    // status window ate it
        }

        if(AM_Responder(ev)) {
            return true;    // automap ate it
        }
    }

    // Handle screen specific ticcmds
    if(gamestate == GS_SKIPPABLE) {
        if(gameaction == ga_nothing) {
            if(ev->type == ev_keydown ||
                    (ev->type == ev_mouse && ev->data1) ||
                    ev->type == ev_gamepad) {
                gameaction = ga_title;
                return true;
            }
            return false;
        }
    }

    if((ev->type == ev_keydown) && (ev->data1 == KEY_PAUSE)) {
        sendpause = true;
        return true;
    }

    if(G_ActionResponder(ev)) {
        return true;
    }

    return false;
}