Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <timer>
- #include <timer-logging>
- enum Modes
- {
- bool:ModeEnable,
- bool:ModeIsDefault,
- bool:ModeHUDEnable,
- MCategory:ModeCategory,
- String:ModeName[32],
- ModeOrder,
- Float:ModeStamina,
- bool:ModeAuto,
- Float:ModeBoost,
- Float:ModeGravity,
- bool:ModePreventMoveleft,
- bool:ModePreventMoveright,
- bool:ModePreventMoveforward,
- bool:ModePreventMoveback,
- bool:ModePreventLeft,
- bool:ModePreventRight,
- ModeBlockMovementDirection,
- Float:ModeBlockPreSpeeding,
- ModeMultiBhop,
- bool:ModeSvCheats,
- bool:ModeLJStats,
- bool:ModeDrugs,
- String:ModeTagName[32],
- String:ModeTagShortName[32],
- String:ModeQuickCommand[32],
- Float:ModeTimeScale,
- ModeFOV,
- bool:ModeCustom,
- String:ModeDesc[128],
- bool:ModeFPSMax
- }
- new g_Physics[MAX_MODES][Modes];
- new g_ModeCount = 0;
- new g_ModeCountEnabled = 0;
- new g_ModeCountRanked = 0;
- new g_ModeCountRankedEnabled = 0;
- new g_ModeDefault = -1;
- LoadPhysics()
- {
- new String:sPath[PLATFORM_MAX_PATH];
- BuildPath(Path_SM, sPath, sizeof(sPath), "configs/timer/physics.cfg");
- new Handle:hKv = CreateKeyValues("Physics");
- if (!FileToKeyValues(hKv, sPath))
- {
- CloseHandle(hKv);
- return;
- }
- g_ModeCount = 0;
- g_ModeCountEnabled = 0;
- g_ModeCountRanked = 0;
- g_ModeCountRankedEnabled = 0;
- g_ModeDefault = -1;
- new modeID = -1;
- if (!KvGotoFirstSubKey(hKv))
- {
- CloseHandle(hKv);
- return;
- }
- do
- {
- decl String:sSectionName[32];
- KvGetSectionName(hKv, sSectionName, sizeof(sSectionName));
- modeID = StringToInt(sSectionName);
- if(MAX_MODES-1 > modeID >= 0)
- {
- KvGetString(hKv, "name", g_Physics[g_ModeCount][ModeName], 32);
- g_Physics[g_ModeCount][ModeEnable] = bool:KvGetNum(hKv, "enable", 0);
- g_Physics[g_ModeCount][ModeOrder] = KvGetNum(hKv, "order", 0);
- g_Physics[g_ModeCount][ModeHUDEnable] = bool:KvGetNum(hKv, "hud_enable", 0);
- g_Physics[g_ModeCount][ModeIsDefault] = bool:KvGetNum(hKv, "default", 0);
- g_Physics[g_ModeCount][ModeCategory] = MCategory:KvGetNum(hKv, "category", 0);
- g_Physics[g_ModeCount][ModeStamina] = KvGetFloat(hKv, "stamina", -1.0);
- g_Physics[g_ModeCount][ModeTimeScale] = KvGetFloat(hKv, "timescale", 1.0);
- g_Physics[g_ModeCount][ModeBoost] = KvGetFloat(hKv, "boost", 0.0);
- g_Physics[g_ModeCount][ModeGravity] = KvGetFloat(hKv, "gravity", 1.0);
- g_Physics[g_ModeCount][ModeAuto] = bool:KvGetNum(hKv, "auto", 0);
- g_Physics[g_ModeCount][ModeLJStats] = bool:KvGetNum(hKv, "ljstats", 0);
- g_Physics[g_ModeCount][ModeMultiBhop] = KvGetNum(hKv, "multimode", 0);
- g_Physics[g_ModeCount][ModeFOV] = KvGetNum(hKv, "fov", 90);
- g_Physics[g_ModeCount][ModeBlockMovementDirection] = KvGetNum(hKv, "block_direction", 0);
- g_Physics[g_ModeCount][ModePreventMoveleft] = bool:KvGetNum(hKv, "prevent_moveleft", 0);
- g_Physics[g_ModeCount][ModePreventMoveright] = bool:KvGetNum(hKv, "prevent_moveright", 0);
- g_Physics[g_ModeCount][ModePreventLeft] = bool:KvGetNum(hKv, "prevent_left", 0);
- g_Physics[g_ModeCount][ModePreventRight] = bool:KvGetNum(hKv, "prevent_right", 0);
- g_Physics[g_ModeCount][ModePreventMoveback] = bool:KvGetNum(hKv, "prevent_back", 0);
- g_Physics[g_ModeCount][ModePreventMoveforward] = bool:KvGetNum(hKv, "prevent_forward", 0);
- g_Physics[g_ModeCount][ModeSvCheats] = bool:KvGetNum(hKv, "sv_cheats", 0);
- g_Physics[g_ModeCount][ModeDrugs] = bool:KvGetNum(hKv, "drugs", 0);
- g_Physics[g_ModeCount][ModeCustom] = bool:KvGetNum(hKv, "custom", 0);
- g_Physics[g_ModeCount][ModeFPSMax] = bool:KvGetNum(hKv, "fps_max", 0);
- g_Physics[g_ModeCount][ModeBlockPreSpeeding] = KvGetFloat(hKv, "prespeed", 0.0);
- KvGetString(hKv, "tag_name", g_Physics[g_ModeCount][ModeTagName], 32);
- KvGetString(hKv, "tag_shortname", g_Physics[g_ModeCount][ModeTagShortName], 32);
- KvGetString(hKv, "chat_command", g_Physics[g_ModeCount][ModeQuickCommand], 32);
- if (g_Physics[g_ModeCount][ModeIsDefault] && g_ModeDefault != g_ModeCount)
- {
- if(g_ModeDefault != -1) Timer_LogError("PhysicsCFG: More than one default mode detected!");
- g_ModeDefault = g_ModeCount;
- }
- if(g_Physics[g_ModeCount][ModeEnable]) g_ModeCountEnabled++;
- if(g_Physics[g_ModeCount][ModeCategory] == MCategory_Ranked)
- {
- g_ModeCountRanked++;
- if(g_Physics[g_ModeCount][ModeEnable]) g_ModeCountRankedEnabled++;
- }
- }
- else Timer_LogError("PhysicsCFG: Invalid mode id: %d",modeID);
- g_ModeCount++;
- } while (KvGotoNextKey(hKv));
- //Timer_Log(Timer_LogLevelInfo, "PhysicsCFG: Loaded config file %d/%d [Ranked %d/%d]", g_ModeCountEnabled, g_ModeCount, g_ModeCountRankedEnabled, g_ModeCountRanked);
- CloseHandle(hKv);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement