예제 #1
0
static void DEH_WeaponParseLine(deh_context_t *context, char *line, void *tag)
{
    char *variable_name, *value;
    weaponinfo_t *weapon;
    int ivalue;

    if (tag == NULL)
        return;

    weapon = (weaponinfo_t *) tag;

    if (!DEH_ParseAssignment(line, &variable_name, &value))
    {
        // Failed to parse

        DEH_Warning(context, "Failed to parse assignment");
        return;
    }

    ivalue = atoi(value);

    // If this is a frame field, we need to map from Heretic 1.0 frame
    // numbers to Heretic 1.3 frame numbers.

    if (M_StrCaseStr(variable_name, "frame") != NULL)
    {
        ivalue = DEH_MapHereticFrameNumber(ivalue);
    }

    DEH_SetMapping(context, &weapon_mapping, weapon, variable_name, ivalue);
}
예제 #2
0
//
// MN_initMetaDeaths
//
// haleyjd 01/22/12: Pull all meta death states out of the player class
// object's metatable.
//
static void MN_initMetaDeaths()
{
   playerclass_t *pclass = players[consoleplayer].pclass;
   MetaTable     *meta   = mobjinfo[pclass->type]->meta;
   MetaState     *state  = NULL;
   
   skview_metadeaths.clear();

   while((state = meta->getNextTypeEx(state)))
   {
      // NB: also matches XDeath implicitly.
      if(M_StrCaseStr(state->getKey(), "Death."))
         skview_metadeaths.add(state);
   }
}
예제 #3
0
void I_InitGamepad(void)
{
    if (SDL_InitSubSystem(SDL_INIT_GAMECONTROLLER | SDL_INIT_HAPTIC) < 0)
        C_Warning("Gamepad support couldn't be initialized.");
    else
    {
        int numjoysticks = SDL_NumJoysticks();

        for (int i = 0; i < numjoysticks; i++)
            if ((joystick = SDL_JoystickOpen(i)))
                if (SDL_IsGameController(i))
                {
                    gamecontroller = SDL_GameControllerOpen(i);
                    break;
                }

        if (!gamecontroller)
            SDL_QuitSubSystem(SDL_INIT_GAMECONTROLLER | SDL_INIT_HAPTIC);
        else
        {
            const char  *name = SDL_GameControllerName(gamecontroller);

            if (*name)
            {
                if (M_StrCaseStr(name, "xinput"))
                    C_Output("An <i><b>XInput</b></i> gamepad is connected.");
                else
                    C_Output("A <i><b>DirectInput</b></i> gamepad called \"%s\" is connected.", name);
            }
            else
                C_Output("A gamepad is connected.");

            if (!(haptic = SDL_HapticOpenFromJoystick(joystick)) || SDL_HapticRumbleInit(haptic) < 0)
                C_Warning("This gamepad doesn't support vibration.");
        }
    }

    gamepadbuttons = 0;
    gamepadthumbLX = 0;
    gamepadthumbLY = 0;
    gamepadthumbRX = 0;
    gamepadthumbRY = 0;
}
예제 #4
0
static void DEH_ThingParseLine(deh_context_t *context, char *line, void *tag)
{
    mobjinfo_t *mobj;
    char *variable_name, *value;
    int ivalue;

    if (tag == NULL)
       return;

    mobj = (mobjinfo_t *) tag;

    // Parse the assignment

    if (!DEH_ParseAssignment(line, &variable_name, &value))
    {
        // Failed to parse

        DEH_Warning(context, "Failed to parse assignment");
        return;
    }

    // all values are integers

    ivalue = atoi(value);

    // If the value to be set is a frame, the frame number must
    // undergo transformation from a Heretic 1.0 index to a
    // Heretic 1.3 index.

    if (M_StrCaseStr(variable_name, "frame") != NULL)
    {
        ivalue = DEH_MapHereticFrameNumber(ivalue);
    }

    // Set the field value

    DEH_SetMapping(context, &thing_mapping, mobj, variable_name, ivalue);
}