// // I_EnumerateGamePads // // Enumerate all gamepads. // void I_EnumerateGamePads() { // Have all supported drivers enumerate their gamepads halpaddriveritem_t *item = halPadDriverTable; while(item->name) { if(item->driver && item->isInit) item->driver->enumerateDevices(); ++item; } // build the master pad directory masterGamePadList.clear(); item = halPadDriverTable; while(item->name) { if(item->driver) { PODCollection<HALGamePad *> &pads = item->driver->devices; for(auto itr = pads.begin(); itr != pads.end(); itr++) masterGamePadList.add(*itr); } ++item; } }
// // Process an individual switch // static void E_processSwitch(cfg_t *cfg) { const char *title = cfg_title(cfg); ESwitchDef *def = e_switch_namehash.objectForKey(title); const bool modified = !!def; if(!def) { def = new ESwitchDef; def->offpic = title; e_switch_namehash.addObject(def); eswitches.add(def); E_EDFLogPrintf("\t\tDefined switch %s\n", title); } else E_EDFLogPrintf("\t\tModified switch %s\n", title); auto isset = [modified, cfg](const char *field) { return !modified || cfg_size(cfg, field) > 0; }; if(isset(ITEM_SWITCH_ONPIC)) def->onpic = cfg_getstr(cfg, ITEM_SWITCH_ONPIC); if(isset(ITEM_SWITCH_ONSOUND)) def->onsound = cfg_getstr(cfg, ITEM_SWITCH_ONSOUND); if(isset(ITEM_SWITCH_OFFSOUND)) def->offsound = cfg_getstr(cfg, ITEM_SWITCH_OFFSOUND); if(isset(ITEM_SWITCH_GAMEINDEX)) def->episode = cfg_getint(cfg, ITEM_SWITCH_GAMEINDEX); }
// // 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); } }
// // Adds a switch defined externally // void E_AddSwitchDef(const ESwitchDef &extdef) { if(extdef.offpic.empty()) return; const char *title = extdef.offpic.constPtr(); ESwitchDef *def = e_switch_namehash.objectForKey(title); // NOTE: by external means, switches can't be modified. EDF takes priority. if(def) return; def = new ESwitchDef(extdef); e_switch_namehash.addObject(def); eswitches.add(def); E_EDFLogPrintf("\t\tDefined switch %s from ANIMDEFS\n", title); }
// // MetaKey // // If the given key string is already interned, the metakey_t structure that // stores it will be returned. If not, it will be added to the collection of // keys and hashed by name. // static metakey_t &MetaKey(const char *key) { metakey_t *keyObj; unsigned int unmodHC = ENCStringHashKey::HashCode(key); // Do we already have this key? if(!(keyObj = metaKeyHash.objectForKey(key, unmodHC))) { keyObj = estructalloc(metakey_t, 1); // add it to the list metaKeys.add(keyObj); keyObj->key = estrdup(key); keyObj->index = metaKeys.getLength() - 1; keyObj->unmodHC = unmodHC; // check for table overload, and hash it MetaHashRebuild<>(metaKeyHash); metaKeyHash.addObject(keyObj, keyObj->unmodHC); } return *keyObj; }