More conversion
This commit is contained in:
Generated
+7
@@ -0,0 +1,7 @@
|
||||
<component name="ProjectDictionaryState">
|
||||
<dictionary name="project">
|
||||
<words>
|
||||
<w>convar</w>
|
||||
</words>
|
||||
</dictionary>
|
||||
</component>
|
||||
Generated
+249
@@ -1,6 +1,255 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="BackendCodeEditorSettings">
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CDeclarationWithImplicitIntType/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CommentTypo/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=ConstevalIfIsAlwaysConstant/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppAbstractClassWithoutSpecifier/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppAbstractFinalClass/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppAbstractVirtualFunctionCallInCtor/@EntryIndexedValue" value="ERROR" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppAccessSpecifierWithNoDeclarations/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppAwaiterTypeIsNotClass/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppBooleanIncrementExpression/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppBoostFormatBadCode/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppBoostFormatLegacyCode/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppBoostFormatMixedArgs/@EntryIndexedValue" value="ERROR" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppBoostFormatTooFewArgs/@EntryIndexedValue" value="ERROR" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppBoostFormatTooManyArgs/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppCStyleCast/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppCVQualifierCanNotBeAppliedToReference/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppClassCanBeFinal/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppClassIsIncomplete/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppClassNeedsConstructorBecauseOfUninitializedMember/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppClassNeverUsed/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppCompileTimeConstantCanBeReplacedWithBooleanConstant/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppConceptNeverUsed/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppConditionalExpressionCanBeSimplified/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppConstParameterInDeclaration/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppConstValueFunctionReturnType/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppConstexprIfDiscardedBranch/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppCoroutineCallResolveError/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAArrayIndexOutOfBounds/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAConstantConditions/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAConstantFunctionResult/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAConstantParameter/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFADeletedPointer/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAEndlessLoop/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAInfiniteRecursion/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAInvalidatedMemory/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFALocalValueEscapesFunction/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFALocalValueEscapesScope/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFALoopConditionNotUpdated/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAMemoryLeak/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFANotInitializedField/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFANullDereference/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFATimeOver/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAUnreachableCode/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAUnreachableFunctionCall/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAUnreadVariable/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAUnusedValue/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeclarationHidesLocal/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeclarationHidesUncapturedLocal/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeclarationSpecifierWithoutDeclarators/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeclaratorDisambiguatedAsFunction/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeclaratorNeverUsed/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeclaratorUsedBeforeInitialization/@EntryIndexedValue" value="ERROR" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDefaultCaseNotHandledInSwitchStatement/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDefaultInitializationWithNoUserConstructor/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDefaultIsUsedAsIdentifier/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDefaultedSpecialMemberFunctionIsImplicitlyDeleted/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDefinitionsOrder/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeletingVoidPointer/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDependentTemplateWithoutTemplateKeyword/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDependentTypeWithoutTypenameKeyword/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeprecatedEntity/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeprecatedOverridenMethod/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeprecatedRegisterStorageClassSpecifier/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDereferenceOperatorLimitExceeded/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDiscardedPostfixOperatorResult/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDoxygenSyntaxError/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDoxygenUndocumentedParameter/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDoxygenUnresolvedReference/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEmptyDeclaration/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceCVQualifiersOrder/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceCVQualifiersPlacement/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceDoStatementBraces/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceForStatementBraces/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceFunctionDeclarationStyle/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceIfStatementBraces/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceNestedNamespacesStyle/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceOverridingDestructorStyle/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceOverridingFunctionStyle/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceTypeAliasCodeStyle/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceWhileStatementBraces/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEntityAssignedButNoRead/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEntityUsedOnlyInUnevaluatedContext/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnumeratorNeverUsed/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEqualOperandsInBinaryExpression/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEvaluationFailure/@EntryIndexedValue" value="ERROR" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppExplicitSpecializationInNonNamespaceScope/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppExpressionWithoutSideEffects/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppFinalFunctionInFinalClass/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppFinalNonOverridingVirtualFunction/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppForLoopCanBeReplacedWithWhile/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppForwardEnumDeclarationWithoutUnderlyingType/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppFunctionDoesntReturnValue/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppFunctionIsNotImplemented/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppFunctionResultShouldBeUsed/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppFunctionalStyleCast/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppHeaderHasBeenAlreadyIncluded/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppHiddenFunction/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppHidingFunction/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppIdenticalOperandsInBinaryExpression/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppIfCanBeReplacedByConstexprIf/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppImplicitDefaultConstructorNotAvailable/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppIncompatiblePointerConversion/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppIncompleteSwitchStatement/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppInconsistentNaming/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppIntegralToPointerConversion/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppInvalidLineContinuation/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppJoinDeclarationAndAssignment/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppLambdaCaptureNeverUsed/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppLocalVariableMayBeConst/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppLocalVariableMightNotBeInitialized/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppLocalVariableWithNonTrivialDtorIsNeverUsed/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppLongFloat/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMemberFunctionMayBeConst/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMemberFunctionMayBeStatic/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMemberInitializersOrder/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMismatchedClassTags/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMissingIncludeGuard/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMissingKeywordThrow/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppModulePartitionWithSeveralPartitionUnits/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMsExtAddressOfClassRValue/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMsExtBindingRValueToLvalueReference/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMsExtCopyElisionInCopyInitDeclarator/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMsExtDoubleUserConversionInCopyInit/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMsExtNotInitializedStaticConstLocalVar/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMsExtReinterpretCastFromNullptr/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMultiCharacterLiteral/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMultiCharacterWideLiteral/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMustBePublicVirtualToImplementInterface/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMutableSpecifierOnReferenceMember/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNoDiscardExpression/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNodiscardFunctionWithoutReturnValue/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNonExceptionSafeResourceAcquisition/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNonExplicitConversionOperator/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNonExplicitConvertingConstructor/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNonInlineFunctionDefinitionInHeaderFile/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNonInlineVariableDefinitionInHeaderFile/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNotAllPathsReturnValue/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppObjectMemberMightNotBeInitialized/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppOutParameterMustBeWritten/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppOverrideWithDifferentVisibility/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppParameterMayBeConst/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppParameterMayBeConstPtrOrRef/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppParameterNamesMismatch/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppParameterNeverUsed/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPassValueParameterByConstReference/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPointerConversionDropsQualifiers/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPointerToIntegralConversion/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPolymorphicClassWithNonVirtualPublicDestructor/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPossiblyErroneousEmptyStatements/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPossiblyUninitializedMember/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPossiblyUnintendedObjectSlicing/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPrecompiledHeaderIsNotIncluded/@EntryIndexedValue" value="ERROR" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPrecompiledHeaderNotFound/@EntryIndexedValue" value="ERROR" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPrintfBadFormat/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPrintfExtraArg/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPrintfMissedArg/@EntryIndexedValue" value="ERROR" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPrintfRiskyFormat/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPrivateSpecialMemberFunctionIsNotImplemented/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRangeBasedForIncompatibleReference/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedefinitionOfDefaultArgumentInOverrideFunction/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantAccessSpecifier/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantBaseClassAccessSpecifier/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantBaseClassInitializer/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantBooleanExpressionArgument/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantCastExpression/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantComplexityInComparison/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantConditionalExpression/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantConstSpecifier/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantControlFlowJump/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantDereferencingAndTakingAddress/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantElaboratedTypeSpecifier/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantElseKeyword/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantElseKeywordInsideCompoundStatement/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantEmptyDeclaration/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantEmptyStatement/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantExportKeyword/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantFwdClassOrEnumSpecifier/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantInlineSpecifier/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantLambdaParameterList/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantMemberInitializer/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantNamespaceDefinition/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantParentheses/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantQualifier/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantQualifierADL/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantStaticSpecifierOnMemberAllocationFunction/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantStaticSpecifierOnThreadLocalLocalVariable/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantTemplateArguments/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantTemplateKeyword/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantTypenameKeyword/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantVoidArgumentList/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantZeroInitializerInAggregateInitialization/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppReferenceToOverriddenVirtualFunction/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppReinterpretCastFromVoidPtr/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRemoveRedundantBraces/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppReplaceMemsetWithZeroInitialization/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppReplaceTieWithStructuredBinding/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppReturnNoValueInNonVoidFunction/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppSmartPointerVsMakeFunction/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppSomeObjectMembersMightNotBeInitialized/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppSpecialFunctionWithoutNoexceptSpecification/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppStaticAssertFailure/@EntryIndexedValue" value="ERROR" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppStaticDataMemberInUnnamedStruct/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppStaticSpecifierOnAnonymousNamespaceMember/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppStringLiteralToCharPointerConversion/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTabsAreDisallowed/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTemplateArgumentsCanBeDeduced/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTemplateParameterNeverUsed/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTemplateParameterShadowing/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppThrowExpressionCanBeReplacedWithRethrow/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTooWideScope/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTooWideScopeInitStatement/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTypeAliasNeverUsed/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUninitializedDependentBaseClass/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUninitializedNonStaticDataMember/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUnionMemberOfReferenceType/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUnmatchedPragmaEndRegionDirective/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUnmatchedPragmaRegionDirective/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUnnamedNamespaceInHeaderFile/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUnnecessaryWhitespace/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUnsignedZeroComparison/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUnusedIncludeDirective/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseAlgorithmWithCount/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseAssociativeContains/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseAuto/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseAutoForNumeric/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseDesignatedInitializers/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseElementsView/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseEraseAlgorithm/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseFamiliarTemplateSyntaxForGenericLambdas/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseInternalLinkage/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseRangeAlgorithm/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseStdSize/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseStructuredBinding/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseTypeTraitAlias/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUserDefinedLiteralSuffixDoesNotStartWithUnderscore/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUsingResultOfAssignmentAsCondition/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppVariableCanBeMadeConstexpr/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppVirtualFunctionCallInsideCtor/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppVirtualFunctionInFinalClass/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppVolatileParameterInDeclaration/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppWarningDirective/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppWrongIncludesOrder/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppWrongSlashesInIncludeDirective/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppZeroConstantCanBeReplacedWithNullptr/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppZeroValuedExpressionUsedAsNullPointer/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=IdentifierTypo/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=IfStdIsConstantEvaluatedCanBeReplaced/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=StdIsConstantEvaluatedWillAlwaysEvaluateToConstant/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=StringLiteralTypo/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppClangFormat/EnableClangFormatSupport/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_ARGUMENT/@EntryValue" value="true" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_BINARY_EXPRESSIONS_CHAIN/@EntryValue" value="true" type="bool" />
|
||||
|
||||
Generated
+1
-1
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
<mapping directory="" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
Generated
+100
-23
@@ -3,9 +3,13 @@
|
||||
<component name="AutoImportSettings">
|
||||
<option name="autoReloadType" value="SELECTIVE" />
|
||||
</component>
|
||||
<component name="CMakePresetLoader"><![CDATA[{
|
||||
"useNewFormat": true
|
||||
}]]></component>
|
||||
<component name="BackendCodeEditorMiscSettings">
|
||||
<option name="/Default/Housekeeping/FeatureSuggestion/FeatureSuggestionManager/DisabledSuggesters/=SwitchToGoToActionSuggester/@EntryIndexedValue" value="true" type="bool" />
|
||||
<option name="/Default/Housekeeping/LiveTemplatesHousekeeping/HotspotSessionHintIsShown/@EntryValue" value="true" type="bool" />
|
||||
</component>
|
||||
<component name="CMakePresetLoader">{
|
||||
"useNewFormat": true
|
||||
}</component>
|
||||
<component name="CMakeProjectFlavorService">
|
||||
<option name="flavorId" value="CMakePlainProjectFlavor" />
|
||||
</component>
|
||||
@@ -23,8 +27,77 @@
|
||||
</configurations>
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="f5455ea3-1ba8-4b1e-84ce-0eab50a09cdc" name="Changes" comment="">
|
||||
<change afterPath="$PROJECT_DIR$/.gitignore" afterDir="false" />
|
||||
<list default="true" id="f5455ea3-1ba8-4b1e-84ce-0eab50a09cdc" name="Changes" comment="Begin converting QS engine to CPP">
|
||||
<change afterPath="$PROJECT_DIR$/.idea/dictionaries/project.xml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/Quake/convar.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/editor.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/editor.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/vcs.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/vcs.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/CMakeLists.txt" beforeDir="false" afterPath="$PROJECT_DIR$/CMakeLists.txt" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Misc/fix_externaltex.patch" beforeDir="false" afterPath="$PROJECT_DIR$/Misc/fix_externaltex.patch" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Quake/bgmusic.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Quake/bgmusic.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Quake/bgmusic.hpp" beforeDir="false" afterPath="$PROJECT_DIR$/Quake/bgmusic.hpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Quake/cd_sdl.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Quake/cd_sdl.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Quake/cfgfile.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Quake/cfgfile.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Quake/chase.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Quake/chase.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Quake/cl_demo.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Quake/cl_demo.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Quake/cl_input.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Quake/cl_input.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Quake/cl_main.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Quake/cl_main.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Quake/cl_parse.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Quake/cl_parse.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Quake/client.hpp" beforeDir="false" afterPath="$PROJECT_DIR$/Quake/client.hpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Quake/cmd.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Quake/cmd.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Quake/cmd.hpp" beforeDir="false" afterPath="$PROJECT_DIR$/Quake/cmd.hpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Quake/common.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Quake/common.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Quake/common.hpp" beforeDir="false" afterPath="$PROJECT_DIR$/Quake/common.hpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Quake/console.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Quake/console.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Quake/cvar.cpp" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Quake/cvar.hpp" beforeDir="false" afterPath="$PROJECT_DIR$/Quake/convar.hpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Quake/gl_draw.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Quake/gl_draw.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Quake/gl_fog.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Quake/gl_fog.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Quake/gl_model.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Quake/gl_model.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Quake/gl_refrag.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Quake/gl_refrag.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Quake/gl_rlight.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Quake/gl_rlight.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Quake/gl_rmain.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Quake/gl_rmain.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Quake/gl_rmisc.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Quake/gl_rmisc.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Quake/gl_screen.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Quake/gl_screen.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Quake/gl_sky.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Quake/gl_sky.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Quake/gl_texmgr.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Quake/gl_texmgr.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Quake/gl_vidsdl.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Quake/gl_vidsdl.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Quake/gl_warp.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Quake/gl_warp.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Quake/glquake.hpp" beforeDir="false" afterPath="$PROJECT_DIR$/Quake/glquake.hpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Quake/host.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Quake/host.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Quake/host_cmd.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Quake/host_cmd.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Quake/in_sdl.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Quake/in_sdl.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Quake/keys.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Quake/keys.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Quake/menu.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Quake/menu.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Quake/net.hpp" beforeDir="false" afterPath="$PROJECT_DIR$/Quake/net.hpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Quake/net_dgrm.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Quake/net_dgrm.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Quake/net_main.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Quake/net_main.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Quake/pl_linux.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Quake/pl_linux.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Quake/pl_osx.m" beforeDir="false" afterPath="$PROJECT_DIR$/Quake/pl_osx.m" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Quake/pl_win.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Quake/pl_win.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Quake/pr_cmds.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Quake/pr_cmds.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Quake/pr_edict.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Quake/pr_edict.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Quake/progs.hpp" beforeDir="false" afterPath="$PROJECT_DIR$/Quake/progs.hpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Quake/q_sound.hpp" beforeDir="false" afterPath="$PROJECT_DIR$/Quake/q_sound.hpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Quake/q_stdinc.hpp" beforeDir="false" afterPath="$PROJECT_DIR$/Quake/q_stdinc.hpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Quake/quakedef.hpp" beforeDir="false" afterPath="$PROJECT_DIR$/Quake/quakedef.hpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Quake/r_alias.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Quake/r_alias.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Quake/r_brush.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Quake/r_brush.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Quake/r_part.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Quake/r_part.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Quake/r_world.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Quake/r_world.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Quake/sbar.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Quake/sbar.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Quake/screen.hpp" beforeDir="false" afterPath="$PROJECT_DIR$/Quake/screen.hpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Quake/server.hpp" beforeDir="false" afterPath="$PROJECT_DIR$/Quake/server.hpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Quake/snd_dma.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Quake/snd_dma.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Quake/snd_mp3.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Quake/snd_mp3.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Quake/sv_main.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Quake/sv_main.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Quake/sv_phys.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Quake/sv_phys.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Quake/sv_user.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Quake/sv_user.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Quake/sys_sdl_unix.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Quake/sys_sdl_unix.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Quake/view.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Quake/view.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Quake/view.hpp" beforeDir="false" afterPath="$PROJECT_DIR$/Quake/view.hpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Quake/zone.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Quake/zone.cpp" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
@@ -38,6 +111,9 @@
|
||||
<component name="Git.Settings">
|
||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
||||
</component>
|
||||
<component name="HighlightingSettingsPerFile">
|
||||
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||
</component>
|
||||
<component name="MacroExpansionManager">
|
||||
<option name="directoryName" value="5yRIaLtN" />
|
||||
</component>
|
||||
@@ -47,10 +123,10 @@
|
||||
<option name="minorVersion" value="2.1" />
|
||||
<option name="productBranch" value="Classic" />
|
||||
</component>
|
||||
<component name="ProjectColorInfo"><![CDATA[{
|
||||
"associatedIndex": 6,
|
||||
"fromUser": false
|
||||
}]]></component>
|
||||
<component name="ProjectColorInfo">{
|
||||
"associatedIndex": 6,
|
||||
"fromUser": false
|
||||
}</component>
|
||||
<component name="ProjectId" id="3IFldDeo8ZZSrZixdcT6JdBiaj1" />
|
||||
<component name="ProjectViewState">
|
||||
<option name="hideEmptyMiddlePackages" value="true" />
|
||||
@@ -64,13 +140,15 @@
|
||||
"RunOnceActivity.RadMigrateCodeStyle": "true",
|
||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||
"RunOnceActivity.cidr.known.project.marker": "true",
|
||||
"RunOnceActivity.git.unshallow": "true",
|
||||
"RunOnceActivity.readMode.enableVisualFormatting": "true",
|
||||
"RunOnceActivity.typescript.service.memoryLimit.init": "true",
|
||||
"SHARE_PROJECT_CONFIGURATION_FILES": "true",
|
||||
"cf.first.check.clang-format": "false",
|
||||
"cidr.known.project.marker": "true",
|
||||
"codeWithMe.voiceChat.enabledByDefault": "false",
|
||||
"git-widget-placeholder": "master",
|
||||
"last_opened_file_path": "/home/iikorni/Downloads/quakespasm-0.96.3",
|
||||
"last_opened_file_path": "/home/iikorni/Downloads/DOOM-master/linuxdoom-1.10",
|
||||
"node.js.detected.package.eslint": "true",
|
||||
"node.js.detected.package.jshint": "true",
|
||||
"node.js.detected.package.tslint": "true",
|
||||
@@ -86,29 +164,24 @@
|
||||
</key>
|
||||
</component>
|
||||
<component name="RunManager">
|
||||
<configuration default="true" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" EMULATE_TERMINAL="false" PASS_PARENT_ENVS_2="true">
|
||||
<method v="2">
|
||||
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<configuration name="quakespasm" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" EMULATE_TERMINAL="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="quakespasm" TARGET_NAME="quakespasm" CONFIG_NAME="Debug" RUN_TARGET_PROJECT_NAME="quakespasm" RUN_TARGET_NAME="quakespasm">
|
||||
<method v="2">
|
||||
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
</component>
|
||||
<component name="SelectedDebugProfileService"><![CDATA[{
|
||||
"profileIdByStamp": [
|
||||
<component name="SelectedDebugProfileService">{
|
||||
"profileIdByStamp": [
|
||||
{
|
||||
"first": {
|
||||
"##RUN_CONFIGURATION##": "CMake Application.quakespasm",
|
||||
"cmake": "CMakeBuildProfile:Debug"
|
||||
"first": {
|
||||
"##RUN_CONFIGURATION##": "CMake Application.quakespasm",
|
||||
"cmake": "CMakeBuildProfile:Debug"
|
||||
},
|
||||
"second": "27852a6b-aee6-4e6c-a703-78c08d632bb7"
|
||||
"second": "27852a6b-aee6-4e6c-a703-78c08d632bb7"
|
||||
}
|
||||
],
|
||||
"modificationCount": 4
|
||||
}]]></component>
|
||||
"modificationCount": 4
|
||||
}</component>
|
||||
<component name="TaskManager">
|
||||
<task active="true" id="Default" summary="Default task">
|
||||
<changelist id="f5455ea3-1ba8-4b1e-84ce-0eab50a09cdc" name="Changes" comment="" />
|
||||
@@ -139,4 +212,8 @@
|
||||
</map>
|
||||
</option>
|
||||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
<MESSAGE value="Begin converting QS engine to CPP" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="Begin converting QS engine to CPP" />
|
||||
</component>
|
||||
</project>
|
||||
+1
-1
@@ -7,7 +7,7 @@ find_package(SDL)
|
||||
find_package(SDL_net)
|
||||
find_package(OpenGL)
|
||||
|
||||
add_executable(quakespasm Quake/bgmusic.cpp Quake/cd_sdl.cpp Quake/cfgfile.cpp Quake/chase.cpp Quake/cl_demo.cpp Quake/cl_input.cpp Quake/cl_main.cpp Quake/cl_parse.cpp Quake/cl_tent.cpp Quake/cmd.cpp Quake/common.cpp Quake/console.cpp Quake/crc.cpp Quake/cvar.cpp Quake/gl_draw.cpp Quake/gl_fog.cpp Quake/gl_mesh.cpp Quake/gl_model.cpp Quake/gl_refrag.cpp Quake/gl_rlight.cpp Quake/gl_rmain.cpp Quake/gl_rmisc.cpp Quake/gl_screen.cpp Quake/gl_sky.cpp Quake/gl_texmgr.cpp Quake/gl_vidsdl.cpp Quake/gl_warp.cpp Quake/host.cpp Quake/host_cmd.cpp Quake/image.cpp Quake/in_sdl.cpp Quake/keys.cpp Quake/main_sdl.cpp Quake/mathlib.cpp Quake/menu.cpp Quake/miniz.cpp Quake/net_bsd.cpp Quake/net_dgrm.cpp Quake/net_loop.cpp Quake/net_main.cpp Quake/net_udp.cpp Quake/pl_linux.cpp Quake/pr_cmds.cpp Quake/pr_edict.cpp Quake/pr_exec.cpp Quake/r_alias.cpp Quake/r_brush.cpp Quake/r_part.cpp Quake/r_sprite.cpp Quake/r_world.cpp Quake/sbar.cpp Quake/snd_codec.cpp Quake/snd_dma.cpp Quake/snd_flac.cpp Quake/snd_mem.cpp Quake/snd_mikmod.cpp Quake/snd_mix.cpp Quake/snd_modplug.cpp Quake/snd_mp3.cpp Quake/snd_mp3tag.cpp Quake/snd_mpg123.cpp Quake/snd_opus.cpp Quake/snd_sdl.cpp Quake/snd_umx.cpp Quake/snd_vorbis.cpp Quake/snd_wave.cpp Quake/snd_xmp.cpp Quake/strlcat.cpp Quake/strlcpy.cpp Quake/sv_main.cpp Quake/sv_move.cpp Quake/sv_phys.cpp Quake/sv_user.cpp Quake/sys_sdl_unix.cpp Quake/view.cpp Quake/wad.cpp Quake/world.cpp Quake/zone.cpp )
|
||||
add_executable(quakespasm Quake/bgmusic.cpp Quake/cd_sdl.cpp Quake/cfgfile.cpp Quake/chase.cpp Quake/cl_demo.cpp Quake/cl_input.cpp Quake/cl_main.cpp Quake/cl_parse.cpp Quake/cl_tent.cpp Quake/cmd.cpp Quake/common.cpp Quake/console.cpp Quake/crc.cpp Quake/convar.cpp Quake/gl_draw.cpp Quake/gl_fog.cpp Quake/gl_mesh.cpp Quake/gl_model.cpp Quake/gl_refrag.cpp Quake/gl_rlight.cpp Quake/gl_rmain.cpp Quake/gl_rmisc.cpp Quake/gl_screen.cpp Quake/gl_sky.cpp Quake/gl_texmgr.cpp Quake/gl_vidsdl.cpp Quake/gl_warp.cpp Quake/host.cpp Quake/host_cmd.cpp Quake/image.cpp Quake/in_sdl.cpp Quake/keys.cpp Quake/main_sdl.cpp Quake/mathlib.cpp Quake/menu.cpp Quake/miniz.cpp Quake/net_bsd.cpp Quake/net_dgrm.cpp Quake/net_loop.cpp Quake/net_main.cpp Quake/net_udp.cpp Quake/pl_linux.cpp Quake/pr_cmds.cpp Quake/pr_edict.cpp Quake/pr_exec.cpp Quake/r_alias.cpp Quake/r_brush.cpp Quake/r_part.cpp Quake/r_sprite.cpp Quake/r_world.cpp Quake/sbar.cpp Quake/snd_codec.cpp Quake/snd_dma.cpp Quake/snd_flac.cpp Quake/snd_mem.cpp Quake/snd_mikmod.cpp Quake/snd_mix.cpp Quake/snd_modplug.cpp Quake/snd_mp3.cpp Quake/snd_mp3tag.cpp Quake/snd_mpg123.cpp Quake/snd_opus.cpp Quake/snd_sdl.cpp Quake/snd_umx.cpp Quake/snd_vorbis.cpp Quake/snd_wave.cpp Quake/snd_xmp.cpp Quake/strlcat.cpp Quake/strlcpy.cpp Quake/sv_main.cpp Quake/sv_move.cpp Quake/sv_phys.cpp Quake/sv_user.cpp Quake/sys_sdl_unix.cpp Quake/view.cpp Quake/wad.cpp Quake/world.cpp Quake/zone.cpp )
|
||||
|
||||
target_link_libraries(quakespasm OpenGL::GL)
|
||||
target_link_libraries(quakespasm SDL::SDL)
|
||||
|
||||
@@ -104,10 +104,10 @@ index 963d55e..e9b251b 100644
|
||||
extern gltexture_t *playertextures[MAX_SCOREBOARD]; //johnfitz
|
||||
|
||||
@@ -230,6 +231,7 @@ void R_Init (void)
|
||||
Cvar_SetCallback (&r_lavaalpha, R_SetLavaalpha_f);
|
||||
Cvar_SetCallback (&r_telealpha, R_SetTelealpha_f);
|
||||
Cvar_SetCallback (&r_slimealpha, R_SetSlimealpha_f);
|
||||
+ Cvar_RegisterVariable (&r_externaltexture_fix);//mk
|
||||
r_lavaalpha.set_callback(R_SetLavaalpha_f);
|
||||
r_telealpha.set_callback(R_SetTelealpha_f);
|
||||
r_slimealpha.set_callback(R_SetSlimealpha_f);
|
||||
+ r_externaltexture_fix.inscribe();//mk
|
||||
|
||||
R_InitParticles ();
|
||||
R_SetClearColor_f (&r_clearcolor); //johnfitz
|
||||
|
||||
+20
-20
@@ -29,7 +29,7 @@
|
||||
#define MUSIC_DIRNAME "music"
|
||||
|
||||
qboolean bgmloop;
|
||||
cvar_t bgm_extmusic = {"bgm_extmusic", "1", CVAR_ARCHIVE};
|
||||
convar bgm_extmusic{"bgm_extmusic", "1", {.archive = true}};
|
||||
|
||||
static qboolean no_extmusic= false;
|
||||
static float old_volume = -1.0f;
|
||||
@@ -76,8 +76,8 @@ static snd_stream_t *bgmstream = NULL;
|
||||
|
||||
static void BGM_Play_f (void)
|
||||
{
|
||||
if (Cmd_Argc() == 2) {
|
||||
BGM_Play (Cmd_Argv(1));
|
||||
if (command::argc() == 2) {
|
||||
BGM_Play (command::argv(1)->c_str());
|
||||
}
|
||||
else {
|
||||
Con_Printf ("music <musicfile>\n");
|
||||
@@ -96,14 +96,14 @@ static void BGM_Resume_f (void)
|
||||
|
||||
static void BGM_Loop_f (void)
|
||||
{
|
||||
if (Cmd_Argc() == 2) {
|
||||
if (q_strcasecmp(Cmd_Argv(1), "0") == 0 ||
|
||||
q_strcasecmp(Cmd_Argv(1),"off") == 0)
|
||||
if (command::argc() == 2) {
|
||||
if (q_strcasecmp(command::argv(1)->c_str(), "0") == 0 ||
|
||||
q_strcasecmp(command::argv(1)->c_str(),"off") == 0)
|
||||
bgmloop = false;
|
||||
else if (q_strcasecmp(Cmd_Argv(1), "1") == 0 ||
|
||||
q_strcasecmp(Cmd_Argv(1),"on") == 0)
|
||||
else if (q_strcasecmp(command::argv(1)->c_str(), "1") == 0 ||
|
||||
q_strcasecmp(command::argv(1)->c_str(),"on") == 0)
|
||||
bgmloop = true;
|
||||
else if (q_strcasecmp(Cmd_Argv(1),"toggle") == 0)
|
||||
else if (q_strcasecmp(command::argv(1)->c_str(),"toggle") == 0)
|
||||
bgmloop = !bgmloop;
|
||||
|
||||
if (bgmstream) bgmstream->loop = bgmloop;
|
||||
@@ -122,11 +122,11 @@ static void BGM_Stop_f (void)
|
||||
|
||||
static void BGM_Jump_f (void)
|
||||
{
|
||||
if (Cmd_Argc() != 2) {
|
||||
if (command::argc() != 2) {
|
||||
Con_Printf ("music_jump <ordernum>\n");
|
||||
}
|
||||
else if (bgmstream) {
|
||||
S_CodecJumpToOrder(bgmstream, atoi(Cmd_Argv(1)));
|
||||
S_CodecJumpToOrder(bgmstream, atoi(command::argv(1)->c_str()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -135,13 +135,13 @@ qboolean BGM_Init (void)
|
||||
music_handler_t *handlers = NULL;
|
||||
int i;
|
||||
|
||||
Cvar_RegisterVariable(&bgm_extmusic);
|
||||
Cmd_AddCommand("music", BGM_Play_f);
|
||||
Cmd_AddCommand("music_pause", BGM_Pause_f);
|
||||
Cmd_AddCommand("music_resume", BGM_Resume_f);
|
||||
Cmd_AddCommand("music_loop", BGM_Loop_f);
|
||||
Cmd_AddCommand("music_stop", BGM_Stop_f);
|
||||
Cmd_AddCommand("music_jump", BGM_Jump_f);
|
||||
bgm_extmusic.inscribe();
|
||||
command::add("music", BGM_Play_f);
|
||||
command::add("music_pause", BGM_Pause_f);
|
||||
command::add("music_resume", BGM_Resume_f);
|
||||
command::add("music_loop", BGM_Loop_f);
|
||||
command::add("music_stop", BGM_Stop_f);
|
||||
command::add("music_jump", BGM_Jump_f);
|
||||
|
||||
if (COM_CheckParm("-noextmusic") != 0)
|
||||
no_extmusic = true;
|
||||
@@ -467,9 +467,9 @@ void BGM_Update (void)
|
||||
if (old_volume != bgmvolume.value)
|
||||
{
|
||||
if (bgmvolume.value < 0)
|
||||
Cvar_SetQuick (&bgmvolume, "0");
|
||||
bgmvolume.set("0");
|
||||
else if (bgmvolume.value > 1)
|
||||
Cvar_SetQuick (&bgmvolume, "1");
|
||||
bgmvolume.set("1");
|
||||
old_volume = bgmvolume.value;
|
||||
}
|
||||
if (bgmstream)
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@
|
||||
#define _BGMUSIC_H_
|
||||
|
||||
extern qboolean bgmloop;
|
||||
extern cvar_t bgm_extmusic;
|
||||
extern convar bgm_extmusic;
|
||||
|
||||
qboolean BGM_Init (void);
|
||||
void BGM_Shutdown (void);
|
||||
|
||||
+7
-7
@@ -221,7 +221,7 @@ static void CD_f (void)
|
||||
const char *command;
|
||||
int ret, n;
|
||||
|
||||
if (Cmd_Argc() < 2)
|
||||
if (command::argc() < 2)
|
||||
{
|
||||
Con_Printf("commands:");
|
||||
Con_Printf("on, off, reset, remap, \n");
|
||||
@@ -230,7 +230,7 @@ static void CD_f (void)
|
||||
return;
|
||||
}
|
||||
|
||||
command = Cmd_Argv (1);
|
||||
command = command::argv (1)->c_str();
|
||||
|
||||
if (q_strcasecmp(command, "on") == 0)
|
||||
{
|
||||
@@ -259,7 +259,7 @@ static void CD_f (void)
|
||||
|
||||
if (q_strcasecmp(command, "remap") == 0)
|
||||
{
|
||||
ret = Cmd_Argc() - 2;
|
||||
ret = command::argc() - 2;
|
||||
if (ret <= 0)
|
||||
{
|
||||
for (n = 1; n < 100; n++)
|
||||
@@ -268,7 +268,7 @@ static void CD_f (void)
|
||||
return;
|
||||
}
|
||||
for (n = 1; n <= ret; n++)
|
||||
remap[n] = atoi(Cmd_Argv (n + 1));
|
||||
remap[n] = atoi(command::argv (n + 1)->c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -284,7 +284,7 @@ static void CD_f (void)
|
||||
|
||||
if (q_strcasecmp(command, "play") == 0)
|
||||
{
|
||||
n = atoi(Cmd_Argv (2));
|
||||
n = atoi(command::argv (2)->c_str());
|
||||
if (n == 0)
|
||||
n = 1;
|
||||
CDAudio_Play((byte)n, false);
|
||||
@@ -293,7 +293,7 @@ static void CD_f (void)
|
||||
|
||||
if (q_strcasecmp(command, "loop") == 0)
|
||||
{
|
||||
CDAudio_Play((byte)atoi(Cmd_Argv (2)), true);
|
||||
CDAudio_Play((byte)atoi(command::argv (2)->c_str()), true);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -564,7 +564,7 @@ int CDAudio_Init(void)
|
||||
cdValid = false;
|
||||
}
|
||||
|
||||
Cmd_AddCommand ("cd", CD_f);
|
||||
command::add ("cd", CD_f);
|
||||
|
||||
hw_vol_works = CD_GetVolume (NULL); /* no SDL support at present. */
|
||||
if (hw_vol_works)
|
||||
|
||||
+2
-2
@@ -94,7 +94,7 @@ void CFG_ReadCvars (const char **vars, int num_vars)
|
||||
tmp = strchr(buff, '\"');
|
||||
if (tmp)
|
||||
{
|
||||
Cvar_Set (vars[i], tmp + 1);
|
||||
convar::set(vars[i], tmp + 1);
|
||||
j++;
|
||||
break;
|
||||
}
|
||||
@@ -135,7 +135,7 @@ void CFG_ReadCvarOverrides (const char **vars, int num_vars)
|
||||
if (j != 0 && j < com_argc - 1)
|
||||
{
|
||||
if (com_argv[j + 1][0] != '-' && com_argv[j + 1][0] != '+')
|
||||
Cvar_Set(vars[i], com_argv[j + 1]);
|
||||
convar::set(vars[i], com_argv[j + 1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+8
-8
@@ -23,10 +23,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#include "quakedef.hpp"
|
||||
|
||||
cvar_t chase_back = {"chase_back", "100", CVAR_NONE};
|
||||
cvar_t chase_up = {"chase_up", "16", CVAR_NONE};
|
||||
cvar_t chase_right = {"chase_right", "0", CVAR_NONE};
|
||||
cvar_t chase_active = {"chase_active", "0", CVAR_NONE};
|
||||
convar chase_back{"chase_back", "100"};
|
||||
convar chase_up{"chase_up", "16"};
|
||||
convar chase_right{"chase_right", "0"};
|
||||
convar chase_active{"chase_active", "0"};
|
||||
|
||||
/*
|
||||
==============
|
||||
@@ -35,10 +35,10 @@ Chase_Init
|
||||
*/
|
||||
void Chase_Init (void)
|
||||
{
|
||||
Cvar_RegisterVariable (&chase_back);
|
||||
Cvar_RegisterVariable (&chase_up);
|
||||
Cvar_RegisterVariable (&chase_right);
|
||||
Cvar_RegisterVariable (&chase_active);
|
||||
chase_back.inscribe();
|
||||
chase_up.inscribe();
|
||||
chase_right.inscribe();
|
||||
chase_active.inscribe();
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
+13
-12
@@ -20,6 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <cstring>
|
||||
#include <format>
|
||||
|
||||
#include "quakedef.hpp"
|
||||
|
||||
@@ -202,7 +203,7 @@ stop recording a demo
|
||||
*/
|
||||
void CL_Stop_f (void)
|
||||
{
|
||||
if (cmd_source != src_command)
|
||||
if (command::last_source != command::source::command)
|
||||
return;
|
||||
|
||||
if (!cls.demorecording)
|
||||
@@ -239,7 +240,7 @@ void CL_Record_f (void)
|
||||
char name[MAX_OSPATH];
|
||||
int track;
|
||||
|
||||
if (cmd_source != src_command)
|
||||
if (command::last_source != command::source::command)
|
||||
return;
|
||||
|
||||
if (cls.demoplayback)
|
||||
@@ -251,14 +252,14 @@ void CL_Record_f (void)
|
||||
if (cls.demorecording)
|
||||
CL_Stop_f();
|
||||
|
||||
c = Cmd_Argc();
|
||||
c = command::argc();
|
||||
if (c != 2 && c != 3 && c != 4)
|
||||
{
|
||||
Con_Printf ("record <demoname> [<map> [cd track]]\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (strstr(Cmd_Argv(1), ".."))
|
||||
if (strstr(command::argv(1).value_or("").c_str(), ".."))
|
||||
{
|
||||
Con_Printf ("Relative pathnames are not allowed.\n");
|
||||
return;
|
||||
@@ -280,7 +281,7 @@ void CL_Record_f (void)
|
||||
// write the forced cd track number, or -1
|
||||
if (c == 4)
|
||||
{
|
||||
track = atoi(Cmd_Argv(3));
|
||||
track = atoi(command::argv(3)->c_str());
|
||||
Con_Printf ("Forcing CD track to %i\n", cls.forcetrack);
|
||||
}
|
||||
else
|
||||
@@ -288,12 +289,12 @@ void CL_Record_f (void)
|
||||
track = -1;
|
||||
}
|
||||
|
||||
q_snprintf (name, sizeof(name), "%s/%s", com_gamedir, Cmd_Argv(1));
|
||||
q_snprintf (name, sizeof(name), "%s/%s", com_gamedir, command::argv(1).value_or("").c_str());
|
||||
|
||||
// start the map up
|
||||
if (c > 2)
|
||||
{
|
||||
Cmd_ExecuteString ( va("map %s", Cmd_Argv(2)), src_command);
|
||||
command::execute_string ( std::format("map {:s}", *command::argv(2)), command::source::command);
|
||||
if (cls.state != ca_connected)
|
||||
return;
|
||||
}
|
||||
@@ -403,10 +404,10 @@ void CL_PlayDemo_f (void)
|
||||
{
|
||||
char name[MAX_OSPATH];
|
||||
|
||||
if (cmd_source != src_command)
|
||||
if (command::last_source != command::source::command)
|
||||
return;
|
||||
|
||||
if (Cmd_Argc() != 2)
|
||||
if (command::argc() != 2)
|
||||
{
|
||||
Con_Printf ("playdemo <demoname> : plays a demo\n");
|
||||
return;
|
||||
@@ -416,7 +417,7 @@ void CL_PlayDemo_f (void)
|
||||
CL_Disconnect ();
|
||||
|
||||
// open the demo file
|
||||
std::strncpy(name, Cmd_Argv(1), sizeof(name));
|
||||
std::strncpy(name, command::argv(1).value_or("").c_str(), sizeof(name));
|
||||
COM_AddExtension (name, ".dem", sizeof(name));
|
||||
|
||||
Con_Printf ("Playing demo from %s.\n", name);
|
||||
@@ -480,10 +481,10 @@ timedemo [demoname]
|
||||
*/
|
||||
void CL_TimeDemo_f (void)
|
||||
{
|
||||
if (cmd_source != src_command)
|
||||
if (command::last_source != command::source::command)
|
||||
return;
|
||||
|
||||
if (Cmd_Argc() != 2)
|
||||
if (command::argc() != 2)
|
||||
{
|
||||
Con_Printf ("timedemo <demoname> : gets demo speeds\n");
|
||||
return;
|
||||
|
||||
+51
-52
@@ -26,8 +26,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#include "quakedef.hpp"
|
||||
|
||||
extern cvar_t cl_maxpitch; //johnfitz -- variable pitch clamping
|
||||
extern cvar_t cl_minpitch; //johnfitz -- variable pitch clamping
|
||||
extern convar cl_maxpitch; //johnfitz -- variable pitch clamping
|
||||
extern convar cl_minpitch; //johnfitz -- variable pitch clamping
|
||||
|
||||
/*
|
||||
===============================================================================
|
||||
@@ -63,11 +63,10 @@ int in_impulse;
|
||||
void KeyDown (kbutton_t *b)
|
||||
{
|
||||
int k;
|
||||
const char *c;
|
||||
|
||||
c = Cmd_Argv(1);
|
||||
if (c[0])
|
||||
k = atoi(c);
|
||||
auto c = command::argv(1).value_or("");
|
||||
if (!c.empty())
|
||||
k = atoi(c.c_str());
|
||||
else
|
||||
k = -1; // typed manually at the console for continuous down
|
||||
|
||||
@@ -94,7 +93,7 @@ void KeyUp (kbutton_t *b)
|
||||
int k;
|
||||
const char *c;
|
||||
|
||||
c = Cmd_Argv(1);
|
||||
c = command::argv(1)->c_str();
|
||||
if (c[0])
|
||||
k = atoi(c);
|
||||
else
|
||||
@@ -161,7 +160,7 @@ void IN_UseUp (void) {KeyUp(&in_use);}
|
||||
void IN_JumpDown (void) {KeyDown(&in_jump);}
|
||||
void IN_JumpUp (void) {KeyUp(&in_jump);}
|
||||
|
||||
void IN_Impulse (void) {in_impulse=Q_atoi(Cmd_Argv(1));}
|
||||
void IN_Impulse (void) {in_impulse=Q_atoi(command::argv(1)->c_str());}
|
||||
|
||||
/*
|
||||
===============
|
||||
@@ -220,19 +219,19 @@ float CL_KeyState (kbutton_t *key)
|
||||
|
||||
//==========================================================================
|
||||
|
||||
cvar_t cl_upspeed = {"cl_upspeed","200",CVAR_NONE};
|
||||
cvar_t cl_forwardspeed = {"cl_forwardspeed","200", CVAR_ARCHIVE};
|
||||
cvar_t cl_backspeed = {"cl_backspeed","200", CVAR_ARCHIVE};
|
||||
cvar_t cl_sidespeed = {"cl_sidespeed","350",CVAR_NONE};
|
||||
convar cl_upspeed{"cl_upspeed","200"};
|
||||
convar cl_forwardspeed{"cl_forwardspeed","200", {.archive = true}};
|
||||
convar cl_backspeed{"cl_backspeed","200", {.archive = true}};
|
||||
convar cl_sidespeed{"cl_sidespeed","350"};
|
||||
|
||||
cvar_t cl_movespeedkey = {"cl_movespeedkey","2.0",CVAR_NONE};
|
||||
convar cl_movespeedkey{"cl_movespeedkey","2.0"};
|
||||
|
||||
cvar_t cl_yawspeed = {"cl_yawspeed","140",CVAR_NONE};
|
||||
cvar_t cl_pitchspeed = {"cl_pitchspeed","150",CVAR_NONE};
|
||||
convar cl_yawspeed{"cl_yawspeed","140"};
|
||||
convar cl_pitchspeed{"cl_pitchspeed","150"};
|
||||
|
||||
cvar_t cl_anglespeedkey = {"cl_anglespeedkey","1.5",CVAR_NONE};
|
||||
convar cl_anglespeedkey{"cl_anglespeedkey","1.5"};
|
||||
|
||||
cvar_t cl_alwaysrun = {"cl_alwaysrun","0",CVAR_ARCHIVE}; // QuakeSpasm -- new always run
|
||||
convar cl_alwaysrun{"cl_alwaysrun","0",{.archive = true}}; // QuakeSpasm -- new always run
|
||||
|
||||
/*
|
||||
================
|
||||
@@ -414,41 +413,41 @@ CL_InitInput
|
||||
*/
|
||||
void CL_InitInput (void)
|
||||
{
|
||||
Cmd_AddCommand ("+moveup",IN_UpDown);
|
||||
Cmd_AddCommand ("-moveup",IN_UpUp);
|
||||
Cmd_AddCommand ("+movedown",IN_DownDown);
|
||||
Cmd_AddCommand ("-movedown",IN_DownUp);
|
||||
Cmd_AddCommand ("+left",IN_LeftDown);
|
||||
Cmd_AddCommand ("-left",IN_LeftUp);
|
||||
Cmd_AddCommand ("+right",IN_RightDown);
|
||||
Cmd_AddCommand ("-right",IN_RightUp);
|
||||
Cmd_AddCommand ("+forward",IN_ForwardDown);
|
||||
Cmd_AddCommand ("-forward",IN_ForwardUp);
|
||||
Cmd_AddCommand ("+back",IN_BackDown);
|
||||
Cmd_AddCommand ("-back",IN_BackUp);
|
||||
Cmd_AddCommand ("+lookup", IN_LookupDown);
|
||||
Cmd_AddCommand ("-lookup", IN_LookupUp);
|
||||
Cmd_AddCommand ("+lookdown", IN_LookdownDown);
|
||||
Cmd_AddCommand ("-lookdown", IN_LookdownUp);
|
||||
Cmd_AddCommand ("+strafe", IN_StrafeDown);
|
||||
Cmd_AddCommand ("-strafe", IN_StrafeUp);
|
||||
Cmd_AddCommand ("+moveleft", IN_MoveleftDown);
|
||||
Cmd_AddCommand ("-moveleft", IN_MoveleftUp);
|
||||
Cmd_AddCommand ("+moveright", IN_MoverightDown);
|
||||
Cmd_AddCommand ("-moveright", IN_MoverightUp);
|
||||
Cmd_AddCommand ("+speed", IN_SpeedDown);
|
||||
Cmd_AddCommand ("-speed", IN_SpeedUp);
|
||||
Cmd_AddCommand ("+attack", IN_AttackDown);
|
||||
Cmd_AddCommand ("-attack", IN_AttackUp);
|
||||
Cmd_AddCommand ("+use", IN_UseDown);
|
||||
Cmd_AddCommand ("-use", IN_UseUp);
|
||||
Cmd_AddCommand ("+jump", IN_JumpDown);
|
||||
Cmd_AddCommand ("-jump", IN_JumpUp);
|
||||
Cmd_AddCommand ("impulse", IN_Impulse);
|
||||
Cmd_AddCommand ("+klook", IN_KLookDown);
|
||||
Cmd_AddCommand ("-klook", IN_KLookUp);
|
||||
Cmd_AddCommand ("+mlook", IN_MLookDown);
|
||||
Cmd_AddCommand ("-mlook", IN_MLookUp);
|
||||
command::add ("+moveup",IN_UpDown);
|
||||
command::add ("-moveup",IN_UpUp);
|
||||
command::add ("+movedown",IN_DownDown);
|
||||
command::add ("-movedown",IN_DownUp);
|
||||
command::add ("+left",IN_LeftDown);
|
||||
command::add ("-left",IN_LeftUp);
|
||||
command::add ("+right",IN_RightDown);
|
||||
command::add ("-right",IN_RightUp);
|
||||
command::add ("+forward",IN_ForwardDown);
|
||||
command::add ("-forward",IN_ForwardUp);
|
||||
command::add ("+back",IN_BackDown);
|
||||
command::add ("-back",IN_BackUp);
|
||||
command::add ("+lookup", IN_LookupDown);
|
||||
command::add ("-lookup", IN_LookupUp);
|
||||
command::add ("+lookdown", IN_LookdownDown);
|
||||
command::add ("-lookdown", IN_LookdownUp);
|
||||
command::add ("+strafe", IN_StrafeDown);
|
||||
command::add ("-strafe", IN_StrafeUp);
|
||||
command::add ("+moveleft", IN_MoveleftDown);
|
||||
command::add ("-moveleft", IN_MoveleftUp);
|
||||
command::add ("+moveright", IN_MoverightDown);
|
||||
command::add ("-moveright", IN_MoverightUp);
|
||||
command::add ("+speed", IN_SpeedDown);
|
||||
command::add ("-speed", IN_SpeedUp);
|
||||
command::add ("+attack", IN_AttackDown);
|
||||
command::add ("-attack", IN_AttackUp);
|
||||
command::add ("+use", IN_UseDown);
|
||||
command::add ("-use", IN_UseUp);
|
||||
command::add ("+jump", IN_JumpDown);
|
||||
command::add ("-jump", IN_JumpUp);
|
||||
command::add ("impulse", IN_Impulse);
|
||||
command::add ("+klook", IN_KLookDown);
|
||||
command::add ("-klook", IN_KLookUp);
|
||||
command::add ("+mlook", IN_MLookDown);
|
||||
command::add ("-mlook", IN_MLookUp);
|
||||
|
||||
}
|
||||
|
||||
|
||||
+52
-52
@@ -28,27 +28,27 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
// references them even when on a unix system.
|
||||
|
||||
// these two are not intended to be set directly
|
||||
cvar_t cl_name = {"_cl_name", "player", CVAR_ARCHIVE};
|
||||
cvar_t cl_color = {"_cl_color", "0", CVAR_ARCHIVE};
|
||||
convar cl_name{"_cl_name", "player", {.archive = true}};
|
||||
convar cl_color{"_cl_color", "0", {.archive = true}};
|
||||
|
||||
cvar_t cl_shownet = {"cl_shownet","0",CVAR_NONE}; // can be 0, 1, or 2
|
||||
cvar_t cl_nolerp = {"cl_nolerp","0",CVAR_NONE};
|
||||
convar cl_shownet{"cl_shownet","0"}; // can be 0, 1, or 2
|
||||
convar cl_nolerp{"cl_nolerp","0"};
|
||||
|
||||
cvar_t cfg_unbindall = {"cfg_unbindall", "1", CVAR_ARCHIVE};
|
||||
convar cfg_unbindall{"cfg_unbindall", "1", {.archive = true}};
|
||||
|
||||
cvar_t lookspring = {"lookspring","0", CVAR_ARCHIVE};
|
||||
cvar_t lookstrafe = {"lookstrafe","0", CVAR_ARCHIVE};
|
||||
cvar_t sensitivity = {"sensitivity","3", CVAR_ARCHIVE};
|
||||
convar lookspring{"lookspring","0", {.archive = true}};
|
||||
convar lookstrafe{"lookstrafe","0", {.archive = true}};
|
||||
convar sensitivity{"sensitivity","3", {.archive = true}};
|
||||
|
||||
cvar_t m_pitch = {"m_pitch","0.022", CVAR_ARCHIVE};
|
||||
cvar_t m_yaw = {"m_yaw","0.022", CVAR_ARCHIVE};
|
||||
cvar_t m_forward = {"m_forward","1", CVAR_ARCHIVE};
|
||||
cvar_t m_side = {"m_side","0.8", CVAR_ARCHIVE};
|
||||
convar m_pitch{"m_pitch","0.022", {.archive = true}};
|
||||
convar m_yaw{"m_yaw","0.022", {.archive = true}};
|
||||
convar m_forward{"m_forward","1", {.archive = true}};
|
||||
convar m_side{"m_side","0.8", {.archive = true}};
|
||||
|
||||
cvar_t cl_maxpitch = {"cl_maxpitch", "90", CVAR_ARCHIVE}; //johnfitz -- variable pitch clamping
|
||||
cvar_t cl_minpitch = {"cl_minpitch", "-90", CVAR_ARCHIVE}; //johnfitz -- variable pitch clamping
|
||||
convar cl_maxpitch{"cl_maxpitch", "90", {.archive = true}}; //johnfitz -- variable pitch clamping
|
||||
convar cl_minpitch{"cl_minpitch", "-90", {.archive = true}}; //johnfitz -- variable pitch clamping
|
||||
|
||||
cvar_t cl_startdemos = {"cl_startdemos", "1", CVAR_ARCHIVE};
|
||||
convar cl_startdemos{"cl_startdemos", "1", {.archive = true}};
|
||||
|
||||
client_static_t cls;
|
||||
client_state_t cl;
|
||||
@@ -63,7 +63,7 @@ int cl_max_edicts; //johnfitz -- only changes when new map loads
|
||||
int cl_numvisedicts;
|
||||
entity_t *cl_visedicts[MAX_VISEDICTS];
|
||||
|
||||
extern cvar_t r_lerpmodels, r_lerpmove; //johnfitz
|
||||
extern convar r_lerpmodels, r_lerpmove; //johnfitz
|
||||
|
||||
/*
|
||||
=====================
|
||||
@@ -651,13 +651,13 @@ int CL_ReadFromServer (void)
|
||||
if (cl_numvisedicts > 256 && dev_peakstats.visedicts <= 256)
|
||||
Con_DWarning ("%i visedicts exceeds standard limit of 256 (max = %d).\n", cl_numvisedicts, MAX_VISEDICTS);
|
||||
dev_stats.visedicts = cl_numvisedicts;
|
||||
dev_peakstats.visedicts = q_max(cl_numvisedicts, dev_peakstats.visedicts);
|
||||
dev_peakstats.visedicts = std::max(cl_numvisedicts, dev_peakstats.visedicts);
|
||||
|
||||
//temp entities
|
||||
if (num_temp_entities > 64 && dev_peakstats.tempents <= 64)
|
||||
Con_DWarning ("%i tempentities exceeds standard limit of 64 (max = %d).\n", num_temp_entities, MAX_TEMP_ENTITIES);
|
||||
dev_stats.tempents = num_temp_entities;
|
||||
dev_peakstats.tempents = q_max(num_temp_entities, dev_peakstats.tempents);
|
||||
dev_peakstats.tempents = std::max(num_temp_entities, dev_peakstats.tempents);
|
||||
|
||||
//beams
|
||||
for (i=0, b=cl_beams ; i< MAX_BEAMS ; i++, b++)
|
||||
@@ -666,7 +666,7 @@ int CL_ReadFromServer (void)
|
||||
if (num_beams > 24 && dev_peakstats.beams <= 24)
|
||||
Con_DWarning ("%i beams exceeded standard limit of 24 (max = %d).\n", num_beams, MAX_BEAMS);
|
||||
dev_stats.beams = num_beams;
|
||||
dev_peakstats.beams = q_max(num_beams, dev_peakstats.beams);
|
||||
dev_peakstats.beams = std::max(num_beams, dev_peakstats.beams);
|
||||
|
||||
//dlights
|
||||
for (i=0, l=cl_dlights ; i<MAX_DLIGHTS ; i++, l++)
|
||||
@@ -675,7 +675,7 @@ int CL_ReadFromServer (void)
|
||||
if (num_dlights > 32 && dev_peakstats.dlights <= 32)
|
||||
Con_DWarning ("%i dlights exceeded standard limit of 32 (max = %d).\n", num_dlights, MAX_DLIGHTS);
|
||||
dev_stats.dlights = num_dlights;
|
||||
dev_peakstats.dlights = q_max(num_dlights, dev_peakstats.dlights);
|
||||
dev_peakstats.dlights = std::max(num_dlights, dev_peakstats.dlights);
|
||||
|
||||
//johnfitz
|
||||
|
||||
@@ -798,44 +798,44 @@ void CL_Init (void)
|
||||
CL_InitInput ();
|
||||
CL_InitTEnts ();
|
||||
|
||||
Cvar_RegisterVariable (&cl_name);
|
||||
Cvar_RegisterVariable (&cl_color);
|
||||
Cvar_RegisterVariable (&cl_upspeed);
|
||||
Cvar_RegisterVariable (&cl_forwardspeed);
|
||||
Cvar_RegisterVariable (&cl_backspeed);
|
||||
Cvar_RegisterVariable (&cl_sidespeed);
|
||||
Cvar_RegisterVariable (&cl_movespeedkey);
|
||||
Cvar_RegisterVariable (&cl_yawspeed);
|
||||
Cvar_RegisterVariable (&cl_pitchspeed);
|
||||
Cvar_RegisterVariable (&cl_anglespeedkey);
|
||||
Cvar_RegisterVariable (&cl_shownet);
|
||||
Cvar_RegisterVariable (&cl_nolerp);
|
||||
Cvar_RegisterVariable (&lookspring);
|
||||
Cvar_RegisterVariable (&lookstrafe);
|
||||
Cvar_RegisterVariable (&sensitivity);
|
||||
cl_name.inscribe();
|
||||
cl_color.inscribe();
|
||||
cl_upspeed.inscribe();
|
||||
cl_forwardspeed.inscribe();
|
||||
cl_backspeed.inscribe();
|
||||
cl_sidespeed.inscribe();
|
||||
cl_movespeedkey.inscribe();
|
||||
cl_yawspeed.inscribe();
|
||||
cl_pitchspeed.inscribe();
|
||||
cl_anglespeedkey.inscribe();
|
||||
cl_shownet.inscribe();
|
||||
cl_nolerp.inscribe();
|
||||
lookspring.inscribe();
|
||||
lookstrafe.inscribe();
|
||||
sensitivity.inscribe();
|
||||
|
||||
Cvar_RegisterVariable (&cl_alwaysrun);
|
||||
cl_alwaysrun.inscribe();
|
||||
|
||||
Cvar_RegisterVariable (&m_pitch);
|
||||
Cvar_RegisterVariable (&m_yaw);
|
||||
Cvar_RegisterVariable (&m_forward);
|
||||
Cvar_RegisterVariable (&m_side);
|
||||
m_pitch.inscribe();
|
||||
m_yaw.inscribe();
|
||||
m_forward.inscribe();
|
||||
m_side.inscribe();
|
||||
|
||||
Cvar_RegisterVariable (&cfg_unbindall);
|
||||
cfg_unbindall.inscribe();
|
||||
|
||||
Cvar_RegisterVariable (&cl_maxpitch); //johnfitz -- variable pitch clamping
|
||||
Cvar_RegisterVariable (&cl_minpitch); //johnfitz -- variable pitch clamping
|
||||
cl_maxpitch.inscribe(); //johnfitz -- variable pitch clamping
|
||||
cl_minpitch.inscribe(); //johnfitz -- variable pitch clamping
|
||||
|
||||
Cvar_RegisterVariable (&cl_startdemos);
|
||||
cl_startdemos.inscribe();
|
||||
|
||||
Cmd_AddCommand ("entities", CL_PrintEntities_f);
|
||||
Cmd_AddCommand ("disconnect", CL_Disconnect_f);
|
||||
Cmd_AddCommand ("record", CL_Record_f);
|
||||
Cmd_AddCommand ("stop", CL_Stop_f);
|
||||
Cmd_AddCommand ("playdemo", CL_PlayDemo_f);
|
||||
Cmd_AddCommand ("timedemo", CL_TimeDemo_f);
|
||||
command::add ("entities", CL_PrintEntities_f);
|
||||
command::add ("disconnect", CL_Disconnect_f);
|
||||
command::add ("record", CL_Record_f);
|
||||
command::add ("stop", CL_Stop_f);
|
||||
command::add ("playdemo", CL_PlayDemo_f);
|
||||
command::add ("timedemo", CL_TimeDemo_f);
|
||||
|
||||
Cmd_AddCommand ("tracepos", CL_Tracepos_f); //johnfitz
|
||||
Cmd_AddCommand ("viewpos", CL_Viewpos_f); //johnfitz
|
||||
command::add ("tracepos", CL_Tracepos_f); //johnfitz
|
||||
command::add ("viewpos", CL_Viewpos_f); //johnfitz
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -1067,7 +1067,7 @@ void CL_ParseServerMessage(void) {
|
||||
cl_lightstyle[i].peak = 'a';
|
||||
for (j = 0; j < cl_lightstyle[i].length; j++) {
|
||||
total += cl_lightstyle[i].map[j] - 'a';
|
||||
cl_lightstyle[i].peak = q_max(cl_lightstyle[i].peak, cl_lightstyle[i].map[j]);
|
||||
cl_lightstyle[i].peak = std::max(cl_lightstyle[i].peak, cl_lightstyle[i].map[j]);
|
||||
}
|
||||
cl_lightstyle[i].average = total / cl_lightstyle[i].length + 'a';
|
||||
} else
|
||||
@@ -1214,7 +1214,7 @@ void CL_ParseServerMessage(void) {
|
||||
break;
|
||||
|
||||
case svc_sellscreen:
|
||||
Cmd_ExecuteString("help", src_command);
|
||||
command::execute_string("help", command::source::command);
|
||||
break;
|
||||
|
||||
//johnfitz -- new svc types
|
||||
@@ -1223,7 +1223,7 @@ void CL_ParseServerMessage(void) {
|
||||
break;
|
||||
|
||||
case svc_bf:
|
||||
Cmd_ExecuteString("bf", src_command);
|
||||
command::execute_string("bf", command::source::command);
|
||||
break;
|
||||
|
||||
case svc_fog:
|
||||
|
||||
+25
-25
@@ -230,41 +230,41 @@ typedef struct
|
||||
//
|
||||
// cvars
|
||||
//
|
||||
extern cvar_t cl_name;
|
||||
extern cvar_t cl_color;
|
||||
extern convar cl_name;
|
||||
extern convar cl_color;
|
||||
|
||||
extern cvar_t cl_upspeed;
|
||||
extern cvar_t cl_forwardspeed;
|
||||
extern cvar_t cl_backspeed;
|
||||
extern cvar_t cl_sidespeed;
|
||||
extern convar cl_upspeed;
|
||||
extern convar cl_forwardspeed;
|
||||
extern convar cl_backspeed;
|
||||
extern convar cl_sidespeed;
|
||||
|
||||
extern cvar_t cl_movespeedkey;
|
||||
extern convar cl_movespeedkey;
|
||||
|
||||
extern cvar_t cl_yawspeed;
|
||||
extern cvar_t cl_pitchspeed;
|
||||
extern convar cl_yawspeed;
|
||||
extern convar cl_pitchspeed;
|
||||
|
||||
extern cvar_t cl_anglespeedkey;
|
||||
extern convar cl_anglespeedkey;
|
||||
|
||||
extern cvar_t cl_alwaysrun; // QuakeSpasm
|
||||
extern convar cl_alwaysrun; // QuakeSpasm
|
||||
|
||||
extern cvar_t cl_autofire;
|
||||
extern convar cl_autofire;
|
||||
|
||||
extern cvar_t cl_shownet;
|
||||
extern cvar_t cl_nolerp;
|
||||
extern convar cl_shownet;
|
||||
extern convar cl_nolerp;
|
||||
|
||||
extern cvar_t cfg_unbindall;
|
||||
extern convar cfg_unbindall;
|
||||
|
||||
extern cvar_t cl_pitchdriftspeed;
|
||||
extern cvar_t lookspring;
|
||||
extern cvar_t lookstrafe;
|
||||
extern cvar_t sensitivity;
|
||||
extern convar cl_pitchdriftspeed;
|
||||
extern convar lookspring;
|
||||
extern convar lookstrafe;
|
||||
extern convar sensitivity;
|
||||
|
||||
extern cvar_t m_pitch;
|
||||
extern cvar_t m_yaw;
|
||||
extern cvar_t m_forward;
|
||||
extern cvar_t m_side;
|
||||
extern convar m_pitch;
|
||||
extern convar m_yaw;
|
||||
extern convar m_forward;
|
||||
extern convar m_side;
|
||||
|
||||
extern cvar_t cl_startdemos;
|
||||
extern convar cl_startdemos;
|
||||
|
||||
|
||||
#define MAX_TEMP_ENTITIES 256 //johnfitz -- was 64
|
||||
@@ -368,7 +368,7 @@ void CL_SignonReply (void);
|
||||
//
|
||||
// chase
|
||||
//
|
||||
extern cvar_t chase_active;
|
||||
extern convar chase_active;
|
||||
|
||||
void Chase_Init (void);
|
||||
void TraceLine (vec3_t start, vec3_t end, vec3_t impact);
|
||||
|
||||
+493
-672
File diff suppressed because it is too large
Load Diff
+50
-30
@@ -20,8 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef _QUAKE_CMD_H
|
||||
#define _QUAKE_CMD_H
|
||||
#pragma once
|
||||
|
||||
// cmd.h -- Command buffer and command execution
|
||||
|
||||
@@ -72,56 +71,77 @@ not apropriate.
|
||||
|
||||
typedef void (*xcommand_t) (void);
|
||||
|
||||
typedef enum
|
||||
{
|
||||
src_client, // came in over a net connection as a clc_stringcmd
|
||||
// host_client will be valid during this state.
|
||||
src_command // from the command buffer
|
||||
} cmd_source_t;
|
||||
|
||||
extern cmd_source_t cmd_source;
|
||||
|
||||
void Cmd_Init (void);
|
||||
namespace command {
|
||||
enum class source {
|
||||
client,
|
||||
command
|
||||
};
|
||||
|
||||
extern source last_source;
|
||||
|
||||
struct alias {
|
||||
std::string name;
|
||||
std::string value;
|
||||
};
|
||||
|
||||
struct definition {
|
||||
std::string name{};
|
||||
xcommand_t func{nullptr};
|
||||
|
||||
definition(const std::string &name, const xcommand_t func) {
|
||||
this->name = name;
|
||||
this->func = func;
|
||||
}
|
||||
};
|
||||
|
||||
using definition_view = std::ranges::elements_view<std::ranges::ref_view<std::map<std::string, definition, std::less<>>>, 1>;
|
||||
using alias_view = std::ranges::elements_view<std::ranges::ref_view<std::map<std::string, alias, std::less<>>>, 1>;
|
||||
|
||||
|
||||
void init();
|
||||
|
||||
void add(const std::string &name, xcommand_t cmd);
|
||||
std::optional<std::string> complete(const std::string &partial);
|
||||
bool exists(std::string_view lookup);
|
||||
|
||||
int argc();
|
||||
std::optional<std::string> argv(int arg);
|
||||
std::string args();
|
||||
|
||||
int check_parm(const std::string &parm);
|
||||
|
||||
void tokenize_string(const std::string &text);
|
||||
|
||||
void execute_string(const std::string &text, source src);
|
||||
|
||||
void forward_to_server();
|
||||
|
||||
definition_view get_commands();
|
||||
|
||||
alias_view get_aliases();
|
||||
}
|
||||
|
||||
void Cmd_AddCommand (const char *cmd_name, xcommand_t function);
|
||||
// called by the init functions of other parts of the program to
|
||||
// register commands and functions to call for them.
|
||||
// The cmd_name is referenced later, so it should not be in temp memory
|
||||
|
||||
qboolean Cmd_Exists (const char *cmd_name);
|
||||
// used by the cvar code to check for cvar / command name overlap
|
||||
|
||||
const char *Cmd_CompleteCommand (const char *partial);
|
||||
// attempts to match a partial command for automatic command line completion
|
||||
// returns NULL if nothing fits
|
||||
|
||||
int Cmd_Argc (void);
|
||||
const char *Cmd_Argv (int arg);
|
||||
const char *Cmd_Args (void);
|
||||
// The functions that execute commands get their parameters with these
|
||||
// functions. Cmd_Argv () will return an empty string, not a NULL
|
||||
// if arg > argc, so string operations are allways safe.
|
||||
|
||||
int Cmd_CheckParm (const char *parm);
|
||||
// Returns the position (1 to argc-1) in the command's argument list
|
||||
// where the given parameter apears, or 0 if not present
|
||||
|
||||
void Cmd_TokenizeString (const char *text);
|
||||
// Takes a null terminated string. Does not need to be /n terminated.
|
||||
// breaks the string up into arg tokens.
|
||||
|
||||
void Cmd_ExecuteString (const char *text, cmd_source_t src);
|
||||
// Parses a single line of text into arguments and tries to execute it.
|
||||
// The text can come from the command buffer, a remote client, or stdin.
|
||||
|
||||
void Cmd_ForwardToServer (void);
|
||||
// adds the current command line as a clc_stringcmd to the client message.
|
||||
// things like godmode, noclip, etc, are commands directed to the server,
|
||||
// so when they are typed in at the console, they will need to be forwarded.
|
||||
|
||||
void Cmd_Print (const char *text);
|
||||
// used by command functions to send output to either the graphics console or
|
||||
// passed as a print message to the client
|
||||
|
||||
#endif /* _QUAKE_CMD_H */
|
||||
|
||||
|
||||
+755
-979
File diff suppressed because it is too large
Load Diff
+17
-43
@@ -22,6 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#ifndef _Q_COMMON_H
|
||||
#define _Q_COMMON_H
|
||||
#include "convar.hpp"
|
||||
|
||||
// comndef.h -- general definitions
|
||||
|
||||
@@ -57,10 +58,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#define NO_COMMA
|
||||
|
||||
#define IMPL_GENERIC_FUNCS(type, suffix) \
|
||||
static inline type q_min_##suffix (type a, type b) { \
|
||||
static inline type std::min_##suffix (type a, type b) { \
|
||||
return (a < b) ? a : b; \
|
||||
} \
|
||||
static inline type q_max_##suffix (type a, type b) { \
|
||||
static inline type std::max_##suffix (type a, type b) { \
|
||||
return (a > b) ? a : b; \
|
||||
} \
|
||||
static inline type clamp_##suffix (type minval, type val, type maxval) { \
|
||||
@@ -69,30 +70,17 @@ static inline type clamp_##suffix (type minval, type val, type maxval) { \
|
||||
|
||||
GENERIC_TYPES (IMPL_GENERIC_FUNCS, NO_COMMA)
|
||||
|
||||
#define SELECT_Q_MIN(type, suffix) type: q_min_##suffix
|
||||
#define q_min(a, b) _Generic((a) + (b), GENERIC_TYPES (SELECT_Q_MIN, COMMA))(a, b)
|
||||
#define SELECT_std::min(type, suffix) type: std::min_##suffix
|
||||
#define std::min(a, b) _Generic((a) + (b), GENERIC_TYPES (SELECT_std::min, COMMA))(a, b)
|
||||
|
||||
#define SELECT_Q_MAX(type, suffix) type: q_max_##suffix
|
||||
#define q_max(a, b) _Generic((a) + (b), GENERIC_TYPES (SELECT_Q_MAX, COMMA))(a, b)
|
||||
#define SELECT_std::max(type, suffix) type: std::max_##suffix
|
||||
#define std::max(a, b) _Generic((a) + (b), GENERIC_TYPES (SELECT_std::max, COMMA))(a, b)
|
||||
|
||||
#define SELECT_CLAMP(type, suffix) type: clamp_##suffix
|
||||
#define CLAMP(minval, val, maxval) _Generic((minval) + (val) + (maxval), \
|
||||
GENERIC_TYPES (SELECT_CLAMP, COMMA))(minval, val, maxval)
|
||||
|
||||
#elif defined(__GNUC__)
|
||||
/* min and max macros with type checking -- based on tyrquake. */
|
||||
#define q_max(a,b) ({ \
|
||||
const __typeof(a) a_ = (a); \
|
||||
const __typeof(b) b_ = (b); \
|
||||
(void)(&a_ == &b_); \
|
||||
(a_ > b_) ? a_ : b_; \
|
||||
})
|
||||
#define q_min(a,b) ({ \
|
||||
const __typeof(a) a_ = (a); \
|
||||
const __typeof(b) b_ = (b); \
|
||||
(void)(&a_ == &b_); \
|
||||
(a_ < b_) ? a_ : b_; \
|
||||
})
|
||||
#define CLAMP(_minval, x, _maxval) ({ \
|
||||
const __typeof(x) x_ = (x); \
|
||||
const __typeof(_minval) valmin_ = (_minval);\
|
||||
@@ -104,8 +92,8 @@ GENERIC_TYPES (IMPL_GENERIC_FUNCS, NO_COMMA)
|
||||
})
|
||||
|
||||
#else
|
||||
#define q_min(a, b) (((a) < (b)) ? (a) : (b))
|
||||
#define q_max(a, b) (((a) > (b)) ? (a) : (b))
|
||||
#define std::min(a, b) (((a) < (b)) ? (a) : (b))
|
||||
#define std::max(a, b) (((a) > (b)) ? (a) : (b))
|
||||
#define CLAMP(_minval, x, _maxval) \
|
||||
((x) < (_minval) ? (_minval) : \
|
||||
(x) > (_maxval) ? (_maxval) : (x))
|
||||
@@ -237,17 +225,16 @@ extern int q_vsnprintf(char *str, size_t size, const char *format, va_list args)
|
||||
|
||||
//============================================================================
|
||||
|
||||
extern char com_token[1024];
|
||||
extern qboolean com_eof;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
CPE_NOTRUNC, // return parse error in case of overflow
|
||||
CPE_ALLOWTRUNC // truncate com_token in case of overflow
|
||||
} cpe_mode;
|
||||
|
||||
const char *COM_Parse (const char *data);
|
||||
const char *COM_ParseEx (const char *data, cpe_mode mode);
|
||||
namespace common {
|
||||
std::optional<std::string> parse_token(std::istringstream &ss);
|
||||
std::string parse_string_newline(std::istringstream &ss);
|
||||
|
||||
int parse_int_newline(std::istringstream &ss);
|
||||
float parse_float_newline(std::istringstream &ss);
|
||||
}
|
||||
|
||||
|
||||
extern int com_argc;
|
||||
@@ -358,19 +345,6 @@ byte *COM_LoadMallocFile (const char *path, unsigned int *path_id);
|
||||
// Loads in "t" mode so CRLF to LF translation is performed on Windows.
|
||||
byte *COM_LoadMallocFile_TextMode_OSPath (const char *path, long *len_out);
|
||||
|
||||
// Attempts to parse an int, followed by a newline.
|
||||
// Returns advanced buffer position.
|
||||
// Doesn't signal parsing failure, but this is not needed for savegame loading.
|
||||
const char *COM_ParseIntNewline(const char *buffer, int *value);
|
||||
|
||||
// Attempts to parse a float followed by a newline.
|
||||
// Returns advanced buffer position.
|
||||
const char *COM_ParseFloatNewline(const char *buffer, float *value);
|
||||
|
||||
// Parse a string of non-whitespace into com_token, then tries to consume a
|
||||
// newline. Returns advanced buffer position.
|
||||
const char *COM_ParseStringNewline(const char *buffer);
|
||||
|
||||
|
||||
#define FS_ENT_NONE (0)
|
||||
#define FS_ENT_FILE (1 << 0)
|
||||
@@ -403,7 +377,7 @@ char *FS_fgets(char *s, int size, fshandle_t *fh);
|
||||
long FS_filelength (fshandle_t *fh);
|
||||
|
||||
|
||||
extern struct cvar_s registered;
|
||||
extern convar registered;
|
||||
extern qboolean standard_quake, rogue, hipnotic;
|
||||
extern qboolean fitzmode;
|
||||
/* if true, run in fitzquake mode disabling custom quakespasm hacks */
|
||||
|
||||
+21
-37
@@ -50,8 +50,8 @@ int con_current; // where next message will be printed
|
||||
int con_x; // offset in current line for next print
|
||||
char *con_text = NULL;
|
||||
|
||||
cvar_t con_notifytime = {"con_notifytime","3",CVAR_NONE}; //seconds
|
||||
cvar_t con_logcenterprint = {"con_logcenterprint", "1", CVAR_NONE}; //johnfitz
|
||||
convar con_notifytime{"con_notifytime","3"}; //seconds
|
||||
convar con_logcenterprint{"con_logcenterprint", "1"}; //johnfitz
|
||||
|
||||
char con_lastcenterstring[1024]; //johnfitz
|
||||
|
||||
@@ -78,8 +78,8 @@ const char *Con_Quakebar (int len)
|
||||
static char bar[42];
|
||||
int i;
|
||||
|
||||
len = q_min(len, (int)sizeof(bar) - 2);
|
||||
len = q_min(len, con_linewidth);
|
||||
len = std::min(len, (int)sizeof(bar) - 2);
|
||||
len = std::min(len, con_linewidth);
|
||||
|
||||
bar[0] = '\35';
|
||||
for (i = 1; i < len - 1; i++)
|
||||
@@ -331,14 +331,14 @@ void Con_Init (void)
|
||||
|
||||
Con_Printf ("Console initialized.\n");
|
||||
|
||||
Cvar_RegisterVariable (&con_notifytime);
|
||||
Cvar_RegisterVariable (&con_logcenterprint); //johnfitz
|
||||
con_notifytime.inscribe();
|
||||
con_logcenterprint.inscribe(); //johnfitz
|
||||
|
||||
Cmd_AddCommand ("toggleconsole", Con_ToggleConsole_f);
|
||||
Cmd_AddCommand ("messagemode", Con_MessageMode_f);
|
||||
Cmd_AddCommand ("messagemode2", Con_MessageMode2_f);
|
||||
Cmd_AddCommand ("clear", Con_Clear_f);
|
||||
Cmd_AddCommand ("condump", Con_Dump_f); //johnfitz
|
||||
command::add ("toggleconsole", Con_ToggleConsole_f);
|
||||
command::add ("messagemode", Con_MessageMode_f);
|
||||
command::add ("messagemode2", Con_MessageMode2_f);
|
||||
command::add ("clear", Con_Clear_f);
|
||||
command::add ("condump", Con_Dump_f); //johnfitz
|
||||
con_initialized = true;
|
||||
}
|
||||
|
||||
@@ -658,7 +658,7 @@ void Con_CenterPrintf (int linewidth, const char *fmt, ...)
|
||||
q_vsnprintf (msg, sizeof(msg), fmt, argptr);
|
||||
va_end (argptr);
|
||||
|
||||
linewidth = q_min(linewidth, con_linewidth);
|
||||
linewidth = std::min(linewidth, con_linewidth);
|
||||
for (src = msg; *src; )
|
||||
{
|
||||
dst = line;
|
||||
@@ -727,21 +727,7 @@ tab_t *tablist;
|
||||
|
||||
//defs from elsewhere
|
||||
extern qboolean keydown[256];
|
||||
typedef struct cmd_function_s
|
||||
{
|
||||
struct cmd_function_s *next;
|
||||
const char *name;
|
||||
xcommand_t function;
|
||||
} cmd_function_t;
|
||||
extern cmd_function_t *cmd_functions;
|
||||
#define MAX_ALIAS_NAME 32
|
||||
typedef struct cmdalias_s
|
||||
{
|
||||
struct cmdalias_s *next;
|
||||
char name[MAX_ALIAS_NAME];
|
||||
char *value;
|
||||
} cmdalias_t;
|
||||
extern cmdalias_t *cmd_alias;
|
||||
|
||||
/*
|
||||
============
|
||||
@@ -897,8 +883,6 @@ BuildTabList -- johnfitz
|
||||
*/
|
||||
void BuildTabList (const char *partial)
|
||||
{
|
||||
cmdalias_t *alias;
|
||||
cmd_function_t *cmd;
|
||||
int len;
|
||||
|
||||
tablist = NULL;
|
||||
@@ -907,17 +891,17 @@ void BuildTabList (const char *partial)
|
||||
bash_partial[0] = 0;
|
||||
bash_singlematch = 1;
|
||||
|
||||
for (auto cvar : std::ranges::views::values(CLIENT_VARIABLES))
|
||||
if (!Q_strncmp (partial, cvar->name, len))
|
||||
AddToTabList (cvar->name, "cvar");
|
||||
for (const auto cvar : convar::get_variables())
|
||||
if (!Q_strncmp (partial, cvar->name.c_str(), len))
|
||||
AddToTabList (cvar->name.c_str(), "cvar");
|
||||
|
||||
for (cmd=cmd_functions ; cmd ; cmd=cmd->next)
|
||||
if (!Q_strncmp (partial,cmd->name, len))
|
||||
AddToTabList (cmd->name, "command");
|
||||
for (const auto &ccmd : command::get_commands())
|
||||
if (!Q_strncmp (partial,ccmd.name.c_str(), len))
|
||||
AddToTabList (ccmd.name.c_str(), "command");
|
||||
|
||||
for (alias=cmd_alias ; alias ; alias=alias->next)
|
||||
if (!Q_strncmp (partial, alias->name, len))
|
||||
AddToTabList (alias->name, "alias");
|
||||
for (const auto &alias : command::get_aliases())
|
||||
if (!Q_strncmp (partial, alias.name.c_str(), len))
|
||||
AddToTabList (alias.name.c_str(), "alias");
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -0,0 +1,540 @@
|
||||
/*
|
||||
Copyright (C) 1996-2001 Id Software, Inc.
|
||||
Copyright (C) 2002-2009 John Fitzgibbons and others
|
||||
Copyright (C) 2010-2014 QuakeSpasm developers
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
*/
|
||||
// cvar.c -- dynamic variable tracking
|
||||
|
||||
#include "quakedef.hpp"
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <ranges>
|
||||
#include <memory>
|
||||
#include <cstring>
|
||||
#include <format>
|
||||
|
||||
std::map<std::string, convar *> CLIENT_VARIABLES{};
|
||||
|
||||
//==============================================================================
|
||||
//
|
||||
// USER COMMANDS
|
||||
//
|
||||
//==============================================================================
|
||||
|
||||
/*
|
||||
============
|
||||
Cvar_List_f -- johnfitz
|
||||
============
|
||||
*/
|
||||
void Cvar_List_f() {
|
||||
convar *cvar;
|
||||
const char *partial;
|
||||
int len, count;
|
||||
|
||||
if (command::argc() > 1) {
|
||||
partial = command::argv(1)->c_str();
|
||||
len = Q_strlen(partial);
|
||||
} else {
|
||||
partial = NULL;
|
||||
len = 0;
|
||||
}
|
||||
|
||||
count = 0;
|
||||
for (const auto &[name, var]: CLIENT_VARIABLES) {
|
||||
if (partial && Q_strncmp(partial, name.c_str(), len)) {
|
||||
continue;
|
||||
}
|
||||
Con_SafePrintf("%s%s %s \"%s\"\n",
|
||||
var->flags.archive ? "*" : " ",
|
||||
var->flags.notify ? "s" : " ",
|
||||
name.c_str(),
|
||||
var->string);
|
||||
count++;
|
||||
}
|
||||
|
||||
Con_SafePrintf("%i cvars", count);
|
||||
if (partial) {
|
||||
Con_SafePrintf(" beginning with \"%s\"", partial);
|
||||
}
|
||||
Con_SafePrintf("\n");
|
||||
}
|
||||
|
||||
/*
|
||||
============
|
||||
Cvar_Inc_f -- johnfitz
|
||||
============
|
||||
*/
|
||||
void Cvar_Inc_f(void) {
|
||||
switch (command::argc()) {
|
||||
default:
|
||||
case 1:
|
||||
Con_Printf("inc <cvar> [amount] : increment cvar\n");
|
||||
break;
|
||||
case 2:
|
||||
convar::set_value(*command::argv(1), convar::variable_value(*command::argv(1)).value_or(0.0) + 1);
|
||||
break;
|
||||
case 3:
|
||||
convar::set_value(*command::argv(1), convar::variable_value(*command::argv(1)).value_or(0.0) + Q_atof(command::argv(2)->c_str()));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
============
|
||||
Cvar_Toggle_f -- johnfitz
|
||||
============
|
||||
*/
|
||||
void Cvar_Toggle_f() {
|
||||
switch (command::argc()) {
|
||||
default:
|
||||
case 1:
|
||||
Con_Printf("toggle <cvar> : toggle cvar\n");
|
||||
break;
|
||||
case 2:
|
||||
if (convar::variable_value(*command::argv(1)).value_or(0.0) != 0.0)
|
||||
convar::set(*command::argv(1), "0");
|
||||
else
|
||||
convar::set(*command::argv(1), "1");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
============
|
||||
Cvar_Cycle_f -- johnfitz
|
||||
============
|
||||
*/
|
||||
void Cvar_Cycle_f() {
|
||||
int i;
|
||||
|
||||
if (command::argc() < 3) {
|
||||
Con_Printf("cycle <cvar> <value list>: cycle cvar through a list of values\n");
|
||||
return;
|
||||
}
|
||||
|
||||
//loop through the args until you find one that matches the current cvar value.
|
||||
//yes, this will get stuck on a list that contains the same value twice.
|
||||
//it's not worth dealing with, and i'm not even sure it can be dealt with.
|
||||
for (i = 2; i < command::argc(); i++) {
|
||||
//zero is assumed to be a string, even though it could actually be zero. The worst case
|
||||
//is that the first time you call this command, it won't match on zero when it should, but after that,
|
||||
//it will be comparing strings that all had the same source (the user) so it will work.
|
||||
if (Q_atof(command::argv(i)->c_str()) == 0) {
|
||||
if (!strcmp(command::argv(i)->c_str(), convar::variable_string(*command::argv(1)).value_or("").c_str()))
|
||||
break;
|
||||
} else {
|
||||
if (Q_atof(command::argv(i)->c_str()) == convar::variable_value(*command::argv(1)).value_or(0.0))
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (i == command::argc())
|
||||
convar::set(*command::argv(1), *command::argv(2)); // no match
|
||||
else if (i + 1 == command::argc())
|
||||
convar::set(*command::argv(1), *command::argv(2)); // matched last value in list
|
||||
else
|
||||
convar::set(*command::argv(1), *command::argv(i + 1)); // matched earlier in list
|
||||
}
|
||||
|
||||
/*
|
||||
============
|
||||
Cvar_Reset_f -- johnfitz
|
||||
============
|
||||
*/
|
||||
void Cvar_Reset_f() {
|
||||
switch (command::argc()) {
|
||||
default:
|
||||
case 1:
|
||||
Con_Printf("reset <cvar> : reset cvar to default\n");
|
||||
break;
|
||||
case 2:
|
||||
convar::reset(*command::argv(1));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
============
|
||||
Cvar_ResetAll_f -- johnfitz
|
||||
============
|
||||
*/
|
||||
void Cvar_ResetAll_f(void) {
|
||||
convar *var;
|
||||
|
||||
for (auto name: std::views::keys(CLIENT_VARIABLES))
|
||||
convar::reset(name);
|
||||
}
|
||||
|
||||
/*
|
||||
============
|
||||
Cvar_ResetCfg_f -- QuakeSpasm
|
||||
============
|
||||
*/
|
||||
void Cvar_ResetCfg_f() {
|
||||
for (const auto &var: std::views::values(CLIENT_VARIABLES))
|
||||
if (var->flags.archive) convar::reset(var->name);
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
//
|
||||
// INIT
|
||||
//
|
||||
//==============================================================================
|
||||
|
||||
/*
|
||||
============
|
||||
Cvar_Init -- johnfitz
|
||||
============
|
||||
*/
|
||||
|
||||
void Cvar_Init() {
|
||||
command::add("cvarlist", Cvar_List_f);
|
||||
command::add("toggle", Cvar_Toggle_f);
|
||||
command::add("cycle", Cvar_Cycle_f);
|
||||
command::add("inc", Cvar_Inc_f);
|
||||
command::add("reset", Cvar_Reset_f);
|
||||
command::add("resetall", Cvar_ResetAll_f);
|
||||
command::add("resetcfg", Cvar_ResetCfg_f);
|
||||
}
|
||||
|
||||
std::optional<convar *> convar::find_var(const std::string_view &desired) {
|
||||
for (auto &[name, var]: CLIENT_VARIABLES) {
|
||||
if (name == desired)
|
||||
return var;
|
||||
}
|
||||
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
std::optional<convar *> convar::find_var_after(const std::optional<std::string> &prev_name,
|
||||
const std::optional<cvar_flags> with_flags) {
|
||||
auto iter = CLIENT_VARIABLES.begin();
|
||||
if (prev_name.has_value()) {
|
||||
iter = CLIENT_VARIABLES.find(prev_name.value());
|
||||
if (iter == CLIENT_VARIABLES.end())
|
||||
return std::nullopt;
|
||||
++iter;
|
||||
}
|
||||
|
||||
// search for the next cvar matching the needed flags
|
||||
while (iter != CLIENT_VARIABLES.end()) {
|
||||
if (!with_flags.has_value() || iter->second->flags.matches_mask(with_flags.value()))
|
||||
break;
|
||||
++iter;
|
||||
}
|
||||
|
||||
if (iter != CLIENT_VARIABLES.end()) {
|
||||
return iter->second;
|
||||
}
|
||||
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
void convar::lock_var(const std::string_view &name) {
|
||||
if (const auto var = find_var(name); var.has_value())
|
||||
var.value()->flags.locked = true;
|
||||
}
|
||||
|
||||
void convar::unlock_var(const std::string_view &name) {
|
||||
if (const auto var = find_var(name); var.has_value())
|
||||
var.value()->flags.locked = false;
|
||||
}
|
||||
|
||||
void convar::unlock_all() {
|
||||
for (const auto &var: std::views::values(CLIENT_VARIABLES)) {
|
||||
var->flags.locked = false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a floating-point representation of the `string` value of the `convar` matching `name`.
|
||||
*
|
||||
* @param name The name of the variable to retreive
|
||||
* @return The value of the variable matching `name`, or `std::nullopt` if a variable with
|
||||
* that name cannot be found.
|
||||
*/
|
||||
std::optional<float> convar::variable_value(const std::string_view &name) {
|
||||
const auto var = find_var(name);
|
||||
if (!var.has_value())
|
||||
return std::nullopt;
|
||||
return std::strtof(var.value()->string, nullptr);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the `string` value of the `convar` matching `name`.
|
||||
*
|
||||
* @param name The name of the variable to retreive
|
||||
* @return The value of the variable matching `name`, or `std::nullopt` if a variable with
|
||||
* that name cannot be found.
|
||||
*/
|
||||
std::optional<std::string> convar::variable_string(const std::string_view &name) {
|
||||
const auto var = find_var(name);
|
||||
if (!var.has_value())
|
||||
return std::nullopt;
|
||||
return var.value()->string;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Autocompletes the name of a `convar` starting with `partial`.
|
||||
*
|
||||
* @param partial Partial name of a variable to retrieve
|
||||
* @return The full name of the first variable beginning with `partial`, or `std::nullopt` if
|
||||
* no matching variable is found.
|
||||
*/
|
||||
std::optional<std::string_view> convar::complete_variable(const std::string_view &partial) {
|
||||
if (!partial.empty())
|
||||
return std::nullopt;
|
||||
|
||||
// check functions
|
||||
for (const auto &name: CLIENT_VARIABLES | std::views::keys) {
|
||||
if (name.starts_with(name))
|
||||
return name;
|
||||
}
|
||||
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets a `convar`s `string` to its `default_string` value.
|
||||
*
|
||||
* @param name Name of the convar to reset
|
||||
*/
|
||||
void convar::reset(const std::string &name) {
|
||||
if (const auto var = find_var(name); !var.has_value())
|
||||
Con_Printf("variable \"%s\" not found\n", name.c_str());
|
||||
else
|
||||
var.value()->set(var.value()->default_string);
|
||||
}
|
||||
|
||||
void convar::set(const std::string &new_value) {
|
||||
if (this->flags.rom || this->flags.locked)
|
||||
return;
|
||||
if (!(this->flags.registered))
|
||||
return;
|
||||
|
||||
if (!this->string)
|
||||
this->string = Z_Strdup(new_value.c_str());
|
||||
else {
|
||||
if (!strcmp(this->string, new_value.c_str()))
|
||||
return; // no change
|
||||
|
||||
this->flags.changed = true;
|
||||
|
||||
const std::size_t len = new_value.length();
|
||||
|
||||
if (len != Q_strlen(this->string)) {
|
||||
Z_Free((void *) this->string);
|
||||
this->string = (char *) Z_Malloc(len + 1);
|
||||
}
|
||||
memcpy((char *) this->string, new_value.c_str(), len + 1);
|
||||
}
|
||||
|
||||
this->value = Q_atof(this->string);
|
||||
|
||||
//johnfitz -- save initial value for "reset" command
|
||||
if (!this->default_string)
|
||||
this->default_string = Z_Strdup(this->string);
|
||||
//johnfitz -- during initialization, update default too
|
||||
else if (!host_initialized) {
|
||||
// Sys_Printf("changing default of %s: %s -> %s\n",
|
||||
// this->name, this->default_string, this->string);
|
||||
Z_Free((void *) this->default_string);
|
||||
this->default_string = Z_Strdup(this->string);
|
||||
}
|
||||
//johnfitz
|
||||
|
||||
if (this->callback)
|
||||
this->callback(this);
|
||||
}
|
||||
|
||||
void convar::set_value(const float new_value) {
|
||||
std::string val;
|
||||
|
||||
if (new_value == static_cast<float>(static_cast<int>(new_value)))
|
||||
val = std::format("{:d}", static_cast<int>(new_value));
|
||||
else {
|
||||
val = std::format("{:f}", new_value);
|
||||
|
||||
// kill trailing zeroes
|
||||
val.erase(val.find_last_not_of('0') + 1, std::string::npos);
|
||||
}
|
||||
|
||||
this->set(val);
|
||||
}
|
||||
|
||||
/*
|
||||
============
|
||||
Cvar_Set
|
||||
============
|
||||
*/
|
||||
void convar::set(const std::string &name, const std::string &value) {
|
||||
const auto var = find_var(name);
|
||||
if (!var.has_value()) {
|
||||
// there is an error in C code if this happens
|
||||
Con_Printf("Cvar_Set: variable %s not found\n", name.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
var.value()->set(value);
|
||||
}
|
||||
|
||||
/*
|
||||
============
|
||||
convar::set_value
|
||||
============
|
||||
*/
|
||||
void convar::set_value(const std::string &name, const float new_value) {
|
||||
std::string val;
|
||||
|
||||
if (new_value == static_cast<float>(static_cast<int>(new_value)))
|
||||
val = std::format("{:d}", static_cast<int>(new_value));
|
||||
else {
|
||||
val = std::format("{:f}", new_value);
|
||||
|
||||
// kill trailing zeroes
|
||||
val.erase(val.find_last_not_of('0') + 1, std::string::npos);
|
||||
}
|
||||
|
||||
set(name, val);
|
||||
}
|
||||
|
||||
/*
|
||||
============
|
||||
Cvar_SetROM
|
||||
============
|
||||
*/
|
||||
void convar::set_rom(const std::string_view &name, const std::string value) {
|
||||
if (const auto var = find_var(name); var.has_value()) {
|
||||
var.value()->flags.rom = false;
|
||||
var.value()->set(value);
|
||||
var.value()->flags.rom = true;
|
||||
}
|
||||
}
|
||||
|
||||
void convar::set_value_rom(const std::string_view &name, const float value) {
|
||||
if (const auto var = find_var(name); var.has_value()) {
|
||||
var.value()->flags.rom = false;
|
||||
var.value()->set_value(value);
|
||||
var.value()->flags.rom = true;
|
||||
}
|
||||
}
|
||||
|
||||
convar_view convar::get_variables() {
|
||||
return std::ranges::views::values(CLIENT_VARIABLES);
|
||||
}
|
||||
|
||||
convar::convar(const std::string_view name, const char *str) : convar(name, str, {}) {
|
||||
}
|
||||
|
||||
convar::convar(const std::string_view name, const char *str, const cvar_flags flags) {
|
||||
this->name = name;
|
||||
this->string = str;
|
||||
this->flags = flags;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a freestanding variable to the variable list.
|
||||
*/
|
||||
void convar::inscribe() {
|
||||
char value[512];
|
||||
convar *cursor, *prev; //johnfitz -- sorted list insert
|
||||
|
||||
// first check to see if it has already been defined
|
||||
if (find_var(this->name)) {
|
||||
Con_Printf("Can't register variable %s, already defined\n", this->name.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
// check for overlap with a command
|
||||
if (command::exists(this->name)) {
|
||||
Con_Printf("Cvar_RegisterVariable: %s is a command\n", this->name.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
CLIENT_VARIABLES.emplace(std::string(this->name), this);
|
||||
|
||||
//johnfitz
|
||||
this->flags.registered = true;
|
||||
|
||||
// copy the value off, because future sets will Z_Free it
|
||||
std::strncpy(value, this->string, sizeof(value));
|
||||
this->string = nullptr;
|
||||
this->default_string = nullptr;
|
||||
|
||||
if (!this->flags.callback)
|
||||
this->callback = nullptr;
|
||||
|
||||
// set it through the function to be consistent
|
||||
const bool set_rom = (this->flags.rom);
|
||||
this->flags.rom = false;
|
||||
this->set(value);
|
||||
if (set_rom)
|
||||
this->flags.rom = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a callback function for the variable
|
||||
* @param func Callback to be used (or `nullptr` to disable to callback).
|
||||
*/
|
||||
void convar::set_callback(const cvarcallback_t func) {
|
||||
this->callback = func;
|
||||
this->flags.callback = func != nullptr;
|
||||
}
|
||||
|
||||
/*
|
||||
============
|
||||
Cvar_Command
|
||||
|
||||
Handles variable inspection and changing from the console
|
||||
============
|
||||
*/
|
||||
qboolean Cvar_Command() {
|
||||
// check variables
|
||||
auto var = convar::find_var(command::argv(0).value_or(""));
|
||||
if (!var.has_value())
|
||||
return false;
|
||||
|
||||
// perform a variable print or set
|
||||
if (command::argc() == 1) {
|
||||
Con_Printf("\"%s\" is \"%s\"\n", var.value()->name.c_str(), var.value()->string);
|
||||
return true;
|
||||
}
|
||||
|
||||
convar::set(var.value()->name, *command::argv(1));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
============
|
||||
Cvar_WriteVariables
|
||||
|
||||
Writes lines containing "set variable value" for all variables
|
||||
with the archive flag set to true.
|
||||
============
|
||||
*/
|
||||
void Cvar_WriteVariables(FILE *f) {
|
||||
for (const auto &[name, var]: CLIENT_VARIABLES) {
|
||||
if (var->flags.archive)
|
||||
fprintf(f, "%s \"%s\"\n", name.c_str(), var->string);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,154 @@
|
||||
/*
|
||||
Copyright (C) 1996-2001 Id Software, Inc.
|
||||
Copyright (C) 2002-2009 John Fitzgibbons and others
|
||||
Copyright (C) 2010-2014 QuakeSpasm developers
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
/*
|
||||
cvar_t variables are used to hold scalar or string variables that can
|
||||
be changed or displayed at the console or prog code as well as accessed
|
||||
directly in C code.
|
||||
|
||||
it is sufficient to initialize a cvar_t with just the first two fields,
|
||||
or you can add a ,true flag for variables that you want saved to the
|
||||
configuration file when the game is quit:
|
||||
|
||||
cvar_t r_draworder = {"r_draworder","1"};
|
||||
cvar_t scr_screensize = {"screensize","1",true};
|
||||
|
||||
Cvars must be registered before use, or they will have a 0 value instead
|
||||
of the float interpretation of the string.
|
||||
Generally, all cvar_t declarations should be registered in the apropriate
|
||||
init function before any console commands are executed:
|
||||
|
||||
host_framerate.inscribe();
|
||||
|
||||
C code usually just references a cvar in place:
|
||||
if ( r_draworder.value )
|
||||
|
||||
It could optionally ask for the value to be looked up for a string name:
|
||||
if (Cvar_VariableValue ("r_draworder"))
|
||||
|
||||
Interpreted prog code can access cvars with the cvar(name) or
|
||||
cvar_set (name, value) internal functions:
|
||||
teamplay = cvar("teamplay");
|
||||
cvar_set ("registered", "1");
|
||||
|
||||
The user can access cvars from the console in two ways:
|
||||
r_draworder prints the current value
|
||||
r_draworder 0 sets the current value to 0
|
||||
|
||||
Cvars are restricted from having the same names as commands to keep this
|
||||
interface from being ambiguous.
|
||||
|
||||
*/
|
||||
|
||||
#include <map>
|
||||
#include <optional>
|
||||
#include <ranges>
|
||||
|
||||
#include "convar.hpp"
|
||||
|
||||
void Cvar_Init();
|
||||
|
||||
struct cvar_flags {
|
||||
bool archive{false};
|
||||
bool notify{false};
|
||||
bool server_info{false};
|
||||
bool user_info{false};
|
||||
bool changed{false};
|
||||
bool rom{false};
|
||||
bool locked{false};
|
||||
bool registered{false};
|
||||
bool callback{false};
|
||||
|
||||
[[nodiscard]] bool matches_mask(const cvar_flags &rhs) const {
|
||||
return (!rhs.archive || this->archive) &&
|
||||
(!rhs.notify || this->notify) &&
|
||||
(!rhs.server_info || this->server_info) &&
|
||||
(!rhs.user_info || this->user_info) &&
|
||||
(!rhs.changed || this->changed) &&
|
||||
(!rhs.rom || this->rom) &&
|
||||
(!rhs.locked || this->locked) &&
|
||||
(!rhs.registered || this->registered) &&
|
||||
(!rhs.callback || this->callback);
|
||||
}
|
||||
};
|
||||
|
||||
struct convar;
|
||||
|
||||
typedef void (*cvarcallback_t)(convar *);
|
||||
|
||||
using convar_view = std::ranges::elements_view<std::ranges::ref_view<std::map<std::string, convar *> >, 1>;
|
||||
|
||||
struct convar {
|
||||
std::string name{};
|
||||
const char *string{nullptr};
|
||||
cvar_flags flags{};
|
||||
float value{};
|
||||
const char *default_string{nullptr}; //johnfitz -- remember defaults for reset function
|
||||
cvarcallback_t callback{nullptr};
|
||||
|
||||
convar(std::string_view name, const char *str);
|
||||
|
||||
convar(std::string_view name, const char *str, cvar_flags flags);
|
||||
|
||||
void inscribe();
|
||||
|
||||
void set_callback(cvarcallback_t func);
|
||||
|
||||
void set(const std::string &new_value);
|
||||
|
||||
void set_value(float new_value);
|
||||
|
||||
static std::optional<convar *> find_var(const std::string_view &desired);
|
||||
|
||||
static std::optional<convar *> find_var_after(const std::optional<std::string> &prev_name,
|
||||
std::optional<cvar_flags> with_flags);
|
||||
|
||||
static void reset(const std::string &name);
|
||||
|
||||
static void set(const std::string &name, const std::string &new_value);
|
||||
|
||||
static void set_value(const std::string &name, float new_value);
|
||||
|
||||
static std::optional<std::string_view> complete_variable(const std::string_view &partial);
|
||||
|
||||
static std::optional<float> variable_value(const std::string_view &name);
|
||||
|
||||
static std::optional<std::string> variable_string(const std::string_view &name);
|
||||
|
||||
static void lock_var(const std::string_view &name);
|
||||
|
||||
static void unlock_var(const std::string_view &name);
|
||||
|
||||
static void unlock_all();
|
||||
|
||||
static void set_rom(const std::string_view &name, std::string value);
|
||||
|
||||
static void set_value_rom(const std::string_view &name, float value);
|
||||
|
||||
static convar_view get_variables();
|
||||
};
|
||||
|
||||
qboolean Cvar_Command(void);
|
||||
|
||||
void Cvar_WriteVariables(FILE *f);
|
||||
-560
@@ -1,560 +0,0 @@
|
||||
/*
|
||||
Copyright (C) 1996-2001 Id Software, Inc.
|
||||
Copyright (C) 2002-2009 John Fitzgibbons and others
|
||||
Copyright (C) 2010-2014 QuakeSpasm developers
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
*/
|
||||
// cvar.c -- dynamic variable tracking
|
||||
|
||||
#include "quakedef.hpp"
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <ranges>
|
||||
#include <memory>
|
||||
#include <cstring>
|
||||
|
||||
static cvar_t *cvar_vars;
|
||||
static char cvar_null_string[] = "";
|
||||
|
||||
std::map<std::string, cvar_t* > CLIENT_VARIABLES{};
|
||||
|
||||
//==============================================================================
|
||||
//
|
||||
// USER COMMANDS
|
||||
//
|
||||
//==============================================================================
|
||||
|
||||
void Cvar_Reset(const std::string &name); //johnfitz
|
||||
|
||||
/*
|
||||
============
|
||||
Cvar_List_f -- johnfitz
|
||||
============
|
||||
*/
|
||||
void Cvar_List_f() {
|
||||
cvar_t *cvar;
|
||||
const char *partial;
|
||||
int len, count;
|
||||
|
||||
if (Cmd_Argc() > 1) {
|
||||
partial = Cmd_Argv(1);
|
||||
len = Q_strlen(partial);
|
||||
} else {
|
||||
partial = NULL;
|
||||
len = 0;
|
||||
}
|
||||
|
||||
count = 0;
|
||||
for (const auto &[name, var]: CLIENT_VARIABLES) {
|
||||
if (partial && Q_strncmp(partial, name.c_str(), len)) {
|
||||
continue;
|
||||
}
|
||||
Con_SafePrintf("%s%s %s \"%s\"\n",
|
||||
(var->flags & CVAR_ARCHIVE) ? "*" : " ",
|
||||
(var->flags & CVAR_NOTIFY) ? "s" : " ",
|
||||
name.c_str(),
|
||||
var->string);
|
||||
count++;
|
||||
}
|
||||
|
||||
Con_SafePrintf("%i cvars", count);
|
||||
if (partial) {
|
||||
Con_SafePrintf(" beginning with \"%s\"", partial);
|
||||
}
|
||||
Con_SafePrintf("\n");
|
||||
}
|
||||
|
||||
/*
|
||||
============
|
||||
Cvar_Inc_f -- johnfitz
|
||||
============
|
||||
*/
|
||||
void Cvar_Inc_f(void) {
|
||||
switch (Cmd_Argc()) {
|
||||
default:
|
||||
case 1:
|
||||
Con_Printf("inc <cvar> [amount] : increment cvar\n");
|
||||
break;
|
||||
case 2:
|
||||
Cvar_SetValue(Cmd_Argv(1), Cvar_VariableValue(Cmd_Argv(1)) + 1);
|
||||
break;
|
||||
case 3:
|
||||
Cvar_SetValue(Cmd_Argv(1), Cvar_VariableValue(Cmd_Argv(1)) + Q_atof(Cmd_Argv(2)));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
============
|
||||
Cvar_Toggle_f -- johnfitz
|
||||
============
|
||||
*/
|
||||
void Cvar_Toggle_f(void) {
|
||||
switch (Cmd_Argc()) {
|
||||
default:
|
||||
case 1:
|
||||
Con_Printf("toggle <cvar> : toggle cvar\n");
|
||||
break;
|
||||
case 2:
|
||||
if (Cvar_VariableValue(Cmd_Argv(1)))
|
||||
Cvar_Set(Cmd_Argv(1), "0");
|
||||
else
|
||||
Cvar_Set(Cmd_Argv(1), "1");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
============
|
||||
Cvar_Cycle_f -- johnfitz
|
||||
============
|
||||
*/
|
||||
void Cvar_Cycle_f() {
|
||||
int i;
|
||||
|
||||
if (Cmd_Argc() < 3) {
|
||||
Con_Printf("cycle <cvar> <value list>: cycle cvar through a list of values\n");
|
||||
return;
|
||||
}
|
||||
|
||||
//loop through the args until you find one that matches the current cvar value.
|
||||
//yes, this will get stuck on a list that contains the same value twice.
|
||||
//it's not worth dealing with, and i'm not even sure it can be dealt with.
|
||||
for (i = 2; i < Cmd_Argc(); i++) {
|
||||
//zero is assumed to be a string, even though it could actually be zero. The worst case
|
||||
//is that the first time you call this command, it won't match on zero when it should, but after that,
|
||||
//it will be comparing strings that all had the same source (the user) so it will work.
|
||||
if (Q_atof(Cmd_Argv(i)) == 0) {
|
||||
if (!strcmp(Cmd_Argv(i), Cvar_VariableString(Cmd_Argv(1))))
|
||||
break;
|
||||
} else {
|
||||
if (Q_atof(Cmd_Argv(i)) == Cvar_VariableValue(Cmd_Argv(1)))
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (i == Cmd_Argc())
|
||||
Cvar_Set(Cmd_Argv(1), Cmd_Argv(2)); // no match
|
||||
else if (i + 1 == Cmd_Argc())
|
||||
Cvar_Set(Cmd_Argv(1), Cmd_Argv(2)); // matched last value in list
|
||||
else
|
||||
Cvar_Set(Cmd_Argv(1), Cmd_Argv(i + 1)); // matched earlier in list
|
||||
}
|
||||
|
||||
/*
|
||||
============
|
||||
Cvar_Reset_f -- johnfitz
|
||||
============
|
||||
*/
|
||||
void Cvar_Reset_f() {
|
||||
switch (Cmd_Argc()) {
|
||||
default:
|
||||
case 1:
|
||||
Con_Printf("reset <cvar> : reset cvar to default\n");
|
||||
break;
|
||||
case 2:
|
||||
Cvar_Reset(Cmd_Argv(1));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
============
|
||||
Cvar_ResetAll_f -- johnfitz
|
||||
============
|
||||
*/
|
||||
void Cvar_ResetAll_f(void) {
|
||||
cvar_t *var;
|
||||
|
||||
for (auto name: std::views::keys(CLIENT_VARIABLES))
|
||||
Cvar_Reset(name);
|
||||
}
|
||||
|
||||
/*
|
||||
============
|
||||
Cvar_ResetCfg_f -- QuakeSpasm
|
||||
============
|
||||
*/
|
||||
void Cvar_ResetCfg_f() {
|
||||
for (const auto &var: std::views::values(CLIENT_VARIABLES))
|
||||
if (var->flags & CVAR_ARCHIVE) Cvar_Reset(var->name);
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
//
|
||||
// INIT
|
||||
//
|
||||
//==============================================================================
|
||||
|
||||
/*
|
||||
============
|
||||
Cvar_Init -- johnfitz
|
||||
============
|
||||
*/
|
||||
|
||||
void Cvar_Init() {
|
||||
Cmd_AddCommand("cvarlist", Cvar_List_f);
|
||||
Cmd_AddCommand("toggle", Cvar_Toggle_f);
|
||||
Cmd_AddCommand("cycle", Cvar_Cycle_f);
|
||||
Cmd_AddCommand("inc", Cvar_Inc_f);
|
||||
Cmd_AddCommand("reset", Cvar_Reset_f);
|
||||
Cmd_AddCommand("resetall", Cvar_ResetAll_f);
|
||||
Cmd_AddCommand("resetcfg", Cvar_ResetCfg_f);
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
//
|
||||
// CVAR FUNCTIONS
|
||||
//
|
||||
//==============================================================================
|
||||
|
||||
/*
|
||||
============
|
||||
Cvar_FindVar
|
||||
============
|
||||
*/
|
||||
std::optional<cvar_t *> Cvar_FindVar(const std::string &desired) {
|
||||
for (auto &[name, var]: CLIENT_VARIABLES) {
|
||||
if (name == desired)
|
||||
return var;
|
||||
}
|
||||
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
cvar_t *Cvar_FindVarAfter(const char *prev_name, unsigned int with_flags) {
|
||||
// cvar_t *var;
|
||||
//
|
||||
// if (*prev_name)
|
||||
// {
|
||||
// var = Cvar_FindVar (prev_name);
|
||||
// if (!var)
|
||||
// return NULL;
|
||||
// var = var->next;
|
||||
// }
|
||||
// else
|
||||
// var = cvar_vars;
|
||||
//
|
||||
// // search for the next cvar matching the needed flags
|
||||
// while (var)
|
||||
// {
|
||||
// if ((var->flags & with_flags) || !with_flags)
|
||||
// break;
|
||||
// var = var->next;
|
||||
// }
|
||||
// return var;
|
||||
return nullptr; // TODO
|
||||
}
|
||||
|
||||
/*
|
||||
============
|
||||
Cvar_LockVar
|
||||
============
|
||||
*/
|
||||
void Cvar_LockVar(const std::string &name) {
|
||||
if (const auto var = Cvar_FindVar(name); var.has_value())
|
||||
var.value()->flags |= CVAR_LOCKED;
|
||||
}
|
||||
|
||||
void Cvar_UnlockVar(const std::string &name) {
|
||||
if (const auto var = Cvar_FindVar(name); var.has_value())
|
||||
var.value()->flags &= ~CVAR_LOCKED;
|
||||
}
|
||||
|
||||
void Cvar_UnlockAll() {
|
||||
for (const auto &var: std::views::values(CLIENT_VARIABLES)) {
|
||||
var->flags &= ~CVAR_LOCKED;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
============
|
||||
Cvar_VariableValue
|
||||
============
|
||||
*/
|
||||
float Cvar_VariableValue(const char *var_name) {
|
||||
const auto var = Cvar_FindVar(var_name);
|
||||
if (!var.has_value())
|
||||
return 0;
|
||||
return std::strtof(var.value()->string, nullptr);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
============
|
||||
Cvar_VariableString
|
||||
============
|
||||
*/
|
||||
const char *Cvar_VariableString(const char *var_name) {
|
||||
const auto var = Cvar_FindVar(var_name);
|
||||
if (!var.has_value())
|
||||
return cvar_null_string;
|
||||
return var.value()->string;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
============
|
||||
Cvar_CompleteVariable
|
||||
============
|
||||
*/
|
||||
std::optional<std::string_view> Cvar_CompleteVariable(const std::string_view &partial) {
|
||||
if (!partial.empty())
|
||||
return std::nullopt;
|
||||
|
||||
// check functions
|
||||
for (const auto &name: CLIENT_VARIABLES | std::views::keys) {
|
||||
if (name.contains(name))
|
||||
return name;
|
||||
}
|
||||
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
/*
|
||||
============
|
||||
Cvar_Reset -- johnfitz
|
||||
============
|
||||
*/
|
||||
void Cvar_Reset(const std::string &name) {
|
||||
if (const auto var = Cvar_FindVar(name); !var.has_value())
|
||||
Con_Printf("variable \"%s\" not found\n", name.c_str());
|
||||
else
|
||||
Cvar_SetQuick(var.value(), var.value()->default_string);
|
||||
}
|
||||
|
||||
void Cvar_SetQuick(cvar_t *var, const std::string &value) {
|
||||
if (var->flags & (CVAR_ROM | CVAR_LOCKED))
|
||||
return;
|
||||
if (!(var->flags & CVAR_REGISTERED))
|
||||
return;
|
||||
|
||||
if (!var->string)
|
||||
var->string = Z_Strdup(value.c_str());
|
||||
else {
|
||||
int len;
|
||||
|
||||
if (!strcmp(var->string, value.c_str()))
|
||||
return; // no change
|
||||
|
||||
var->flags |= CVAR_CHANGED;
|
||||
len = value.length();
|
||||
if (len != Q_strlen(var->string)) {
|
||||
Z_Free((void *) var->string);
|
||||
var->string = (char *) Z_Malloc(len + 1);
|
||||
}
|
||||
memcpy((char *) var->string, value.c_str(), len + 1);
|
||||
}
|
||||
|
||||
var->value = Q_atof(var->string);
|
||||
|
||||
//johnfitz -- save initial value for "reset" command
|
||||
if (!var->default_string)
|
||||
var->default_string = Z_Strdup(var->string);
|
||||
//johnfitz -- during initialization, update default too
|
||||
else if (!host_initialized) {
|
||||
// Sys_Printf("changing default of %s: %s -> %s\n",
|
||||
// var->name, var->default_string, var->string);
|
||||
Z_Free((void *) var->default_string);
|
||||
var->default_string = Z_Strdup(var->string);
|
||||
}
|
||||
//johnfitz
|
||||
|
||||
if (var->callback)
|
||||
var->callback(var);
|
||||
}
|
||||
|
||||
void Cvar_SetValueQuick(cvar_t *var, const float value) {
|
||||
char val[32], *ptr = val;
|
||||
|
||||
if (value == (float) ((int) value))
|
||||
q_snprintf(val, sizeof(val), "%i", (int) value);
|
||||
else {
|
||||
q_snprintf(val, sizeof(val), "%f", value);
|
||||
// kill trailing zeroes
|
||||
while (*ptr)
|
||||
ptr++;
|
||||
while (--ptr > val && *ptr == '0' && ptr[-1] != '.')
|
||||
*ptr = '\0';
|
||||
}
|
||||
|
||||
Cvar_SetQuick(var, val);
|
||||
}
|
||||
|
||||
/*
|
||||
============
|
||||
Cvar_Set
|
||||
============
|
||||
*/
|
||||
void Cvar_Set(const std::string &name, const std::string &value) {
|
||||
auto var = Cvar_FindVar(name);
|
||||
if (!var.has_value()) {
|
||||
// there is an error in C code if this happens
|
||||
Con_Printf("Cvar_Set: variable %s not found\n", name.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
Cvar_SetQuick(var.value(), value);
|
||||
}
|
||||
|
||||
/*
|
||||
============
|
||||
Cvar_SetValue
|
||||
============
|
||||
*/
|
||||
void Cvar_SetValue(const char *var_name, const float value) {
|
||||
char val[32], *ptr = val;
|
||||
|
||||
if (value == (float) ((int) value))
|
||||
q_snprintf(val, sizeof(val), "%i", (int) value);
|
||||
else {
|
||||
q_snprintf(val, sizeof(val), "%f", value);
|
||||
// kill trailing zeroes
|
||||
while (*ptr)
|
||||
ptr++;
|
||||
while (--ptr > val && *ptr == '0' && ptr[-1] != '.')
|
||||
*ptr = '\0';
|
||||
}
|
||||
|
||||
Cvar_Set(var_name, val);
|
||||
}
|
||||
|
||||
/*
|
||||
============
|
||||
Cvar_SetROM
|
||||
============
|
||||
*/
|
||||
void Cvar_SetROM(const char *var_name, const char *value) {
|
||||
if (const auto var = Cvar_FindVar(var_name); var.has_value()) {
|
||||
var.value()->flags &= ~CVAR_ROM;
|
||||
Cvar_SetQuick(var.value(), value);
|
||||
var.value()->flags |= CVAR_ROM;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
============
|
||||
Cvar_SetValueROM
|
||||
============
|
||||
*/
|
||||
void Cvar_SetValueROM(const char *var_name, const float value) {
|
||||
if (const auto var = Cvar_FindVar(var_name); var.has_value()) {
|
||||
var.value()->flags &= ~CVAR_ROM;
|
||||
Cvar_SetValueQuick(var.value(), value);
|
||||
var.value()->flags |= CVAR_ROM;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
============
|
||||
Cvar_RegisterVariable
|
||||
|
||||
Adds a freestanding variable to the variable list.
|
||||
============
|
||||
*/
|
||||
void Cvar_RegisterVariable(cvar_t *variable) {
|
||||
char value[512];
|
||||
qboolean set_rom;
|
||||
cvar_t *cursor, *prev; //johnfitz -- sorted list insert
|
||||
|
||||
// first check to see if it has already been defined
|
||||
if (Cvar_FindVar(variable->name)) {
|
||||
Con_Printf("Can't register variable %s, already defined\n", variable->name);
|
||||
return;
|
||||
}
|
||||
|
||||
// check for overlap with a command
|
||||
if (Cmd_Exists(variable->name)) {
|
||||
Con_Printf("Cvar_RegisterVariable: %s is a command\n", variable->name);
|
||||
return;
|
||||
}
|
||||
|
||||
CLIENT_VARIABLES.emplace(std::string(variable->name), variable);
|
||||
|
||||
//johnfitz
|
||||
variable->flags |= CVAR_REGISTERED;
|
||||
|
||||
// copy the value off, because future sets will Z_Free it
|
||||
std::strncpy(value, variable->string, sizeof(value));
|
||||
variable->string = NULL;
|
||||
variable->default_string = NULL;
|
||||
|
||||
if (!(variable->flags & CVAR_CALLBACK))
|
||||
variable->callback = NULL;
|
||||
|
||||
// set it through the function to be consistent
|
||||
set_rom = (variable->flags & CVAR_ROM);
|
||||
variable->flags &= ~CVAR_ROM;
|
||||
Cvar_SetQuick(variable, value);
|
||||
if (set_rom)
|
||||
variable->flags |= CVAR_ROM;
|
||||
}
|
||||
|
||||
/*
|
||||
============
|
||||
Cvar_SetCallback
|
||||
|
||||
Set a callback function to the var
|
||||
============
|
||||
*/
|
||||
void Cvar_SetCallback(cvar_t *var, cvarcallback_t func) {
|
||||
var->callback = func;
|
||||
if (func)
|
||||
var->flags |= CVAR_CALLBACK;
|
||||
else var->flags &= ~CVAR_CALLBACK;
|
||||
}
|
||||
|
||||
/*
|
||||
============
|
||||
Cvar_Command
|
||||
|
||||
Handles variable inspection and changing from the console
|
||||
============
|
||||
*/
|
||||
qboolean Cvar_Command() {
|
||||
// check variables
|
||||
auto var = Cvar_FindVar(Cmd_Argv(0));
|
||||
if (!var.has_value())
|
||||
return false;
|
||||
|
||||
// perform a variable print or set
|
||||
if (Cmd_Argc() == 1) {
|
||||
Con_Printf("\"%s\" is \"%s\"\n", var.value()->name, var.value()->string);
|
||||
return true;
|
||||
}
|
||||
|
||||
Cvar_Set(var.value()->name, Cmd_Argv(1));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
============
|
||||
Cvar_WriteVariables
|
||||
|
||||
Writes lines containing "set variable value" for all variables
|
||||
with the archive flag set to true.
|
||||
============
|
||||
*/
|
||||
void Cvar_WriteVariables(FILE *f) {
|
||||
for (const auto &[name, var] : CLIENT_VARIABLES) {
|
||||
if (var->flags & CVAR_ARCHIVE)
|
||||
fprintf(f, "%s \"%s\"\n", name.c_str(), var->string);
|
||||
}
|
||||
}
|
||||
-146
@@ -1,146 +0,0 @@
|
||||
/*
|
||||
Copyright (C) 1996-2001 Id Software, Inc.
|
||||
Copyright (C) 2002-2009 John Fitzgibbons and others
|
||||
Copyright (C) 2010-2014 QuakeSpasm developers
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef __CVAR_H__
|
||||
#define __CVAR_H__
|
||||
|
||||
/*
|
||||
cvar_t variables are used to hold scalar or string variables that can
|
||||
be changed or displayed at the console or prog code as well as accessed
|
||||
directly in C code.
|
||||
|
||||
it is sufficient to initialize a cvar_t with just the first two fields,
|
||||
or you can add a ,true flag for variables that you want saved to the
|
||||
configuration file when the game is quit:
|
||||
|
||||
cvar_t r_draworder = {"r_draworder","1"};
|
||||
cvar_t scr_screensize = {"screensize","1",true};
|
||||
|
||||
Cvars must be registered before use, or they will have a 0 value instead
|
||||
of the float interpretation of the string.
|
||||
Generally, all cvar_t declarations should be registered in the apropriate
|
||||
init function before any console commands are executed:
|
||||
|
||||
Cvar_RegisterVariable (&host_framerate);
|
||||
|
||||
|
||||
C code usually just references a cvar in place:
|
||||
if ( r_draworder.value )
|
||||
|
||||
It could optionally ask for the value to be looked up for a string name:
|
||||
if (Cvar_VariableValue ("r_draworder"))
|
||||
|
||||
Interpreted prog code can access cvars with the cvar(name) or
|
||||
cvar_set (name, value) internal functions:
|
||||
teamplay = cvar("teamplay");
|
||||
cvar_set ("registered", "1");
|
||||
|
||||
The user can access cvars from the console in two ways:
|
||||
r_draworder prints the current value
|
||||
r_draworder 0 sets the current value to 0
|
||||
|
||||
Cvars are restricted from having the same names as commands to keep this
|
||||
interface from being ambiguous.
|
||||
|
||||
*/
|
||||
|
||||
#define CVAR_NONE 0
|
||||
#define CVAR_ARCHIVE (1U << 0) // if set, causes it to be saved to config
|
||||
#define CVAR_NOTIFY (1U << 1) // changes will be broadcasted to all players (q1)
|
||||
#define CVAR_SERVERINFO (1U << 2) // added to serverinfo will be sent to clients (q1/net_dgrm.c and qwsv)
|
||||
#define CVAR_USERINFO (1U << 3) // added to userinfo, will be sent to server (qwcl)
|
||||
#define CVAR_CHANGED (1U << 4)
|
||||
#define CVAR_ROM (1U << 6)
|
||||
#define CVAR_LOCKED (1U << 8) // locked temporarily
|
||||
#define CVAR_REGISTERED (1U << 10) // the var is added to the list of variables
|
||||
#define CVAR_CALLBACK (1U << 16) // var has a callback
|
||||
|
||||
#include <map>
|
||||
#include <optional>
|
||||
|
||||
typedef void (*cvarcallback_t) (struct cvar_s *);
|
||||
|
||||
typedef struct cvar_s
|
||||
{
|
||||
const char *name;
|
||||
const char *string;
|
||||
unsigned int flags;
|
||||
float value;
|
||||
const char *default_string; //johnfitz -- remember defaults for reset function
|
||||
cvarcallback_t callback;
|
||||
} cvar_t;
|
||||
|
||||
void Cvar_RegisterVariable (cvar_t *variable);
|
||||
// registers a cvar that already has the name, string, and optionally
|
||||
// the archive elements set.
|
||||
|
||||
void Cvar_SetCallback (cvar_t *var, cvarcallback_t func);
|
||||
// set a callback function to the var
|
||||
|
||||
void Cvar_Set(const std::string &name, const std::string &value);
|
||||
// equivelant to "<name> <variable>" typed at the console
|
||||
|
||||
void Cvar_SetValue (const char *var_name, const float value);
|
||||
// expands value to a string and calls Cvar_Set
|
||||
|
||||
void Cvar_SetROM (const char *var_name, const char *value);
|
||||
void Cvar_SetValueROM (const char *var_name, const float value);
|
||||
// sets a CVAR_ROM variable from within the engine
|
||||
|
||||
void Cvar_SetQuick(cvar_t *var, const std::string &value);
|
||||
void Cvar_SetValueQuick (cvar_t *var, const float value);
|
||||
// these two accept a cvar pointer instead of a var name,
|
||||
// but are otherwise identical to the "non-Quick" versions.
|
||||
// the cvar MUST be registered.
|
||||
|
||||
float Cvar_VariableValue (const char *var_name);
|
||||
// returns 0 if not defined or non numeric
|
||||
|
||||
const char *Cvar_VariableString (const char *var_name);
|
||||
// returns an empty string if not defined
|
||||
|
||||
qboolean Cvar_Command (void);
|
||||
// called by Cmd_ExecuteString when Cmd_Argv(0) doesn't match a known
|
||||
// command. Returns true if the command was a variable reference that
|
||||
// was handled. (print or change)
|
||||
|
||||
void Cvar_WriteVariables (FILE *f);
|
||||
// Writes lines containing "set variable value" for all variables
|
||||
// with the CVAR_ARCHIVE flag set
|
||||
|
||||
std::optional<cvar_t*> Cvar_FindVar (const std::string &desired);
|
||||
cvar_t *Cvar_FindVarAfter (const char *prev_name, unsigned int with_flags);
|
||||
|
||||
void Cvar_LockVar(const std::string &name);
|
||||
void Cvar_UnlockVar(const std::string &name);
|
||||
void Cvar_UnlockAll (void);
|
||||
|
||||
void Cvar_Init (void);
|
||||
|
||||
const char *Cvar_CompleteVariable (const char *partial);
|
||||
// attempts to match a partial variable name for command line completion
|
||||
// returns NULL if nothing fits
|
||||
|
||||
extern std::map<std::string, cvar_t* > CLIENT_VARIABLES;
|
||||
|
||||
#endif /* __CVAR_H__ */
|
||||
|
||||
+3
-3
@@ -27,7 +27,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
//extern unsigned char d_15to8table[65536]; //johnfitz -- never used
|
||||
|
||||
cvar_t scr_conalpha = {"scr_conalpha", "0.5", CVAR_ARCHIVE}; //johnfitz
|
||||
convar scr_conalpha = {"scr_conalpha", "0.5", {.archive = true}}; //johnfitz
|
||||
|
||||
qpic_t *draw_disc;
|
||||
qpic_t *draw_backtile;
|
||||
@@ -400,7 +400,7 @@ Draw_Init -- johnfitz -- rewritten
|
||||
*/
|
||||
void Draw_Init (void)
|
||||
{
|
||||
Cvar_RegisterVariable (&scr_conalpha);
|
||||
scr_conalpha.inscribe();
|
||||
|
||||
// clear scrap and allocate gltextures
|
||||
memset(scrap_allocated, 0, sizeof(scrap_allocated));
|
||||
@@ -703,7 +703,7 @@ void GL_SetCanvas (canvastype newcanvas)
|
||||
glViewport (glx, gly, glwidth, glheight);
|
||||
break;
|
||||
case CANVAS_MENU:
|
||||
s = q_min((float)glwidth / 320.0f, (float)glheight / 200.0f);
|
||||
s = std::min((float)glwidth / 320.0f, (float)glheight / 200.0f);
|
||||
s = CLAMP (1.0f, scr_menuscale.value, s);
|
||||
// ericw -- doubled width to 640 to accommodate long keybindings
|
||||
glOrtho (0, 640, 200, 0, -99999, 99999);
|
||||
|
||||
+90
-100
@@ -21,6 +21,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
//gl_fog.c -- global and volumetric fog
|
||||
|
||||
#include <sstream>
|
||||
|
||||
#include "quakedef.hpp"
|
||||
|
||||
//==============================================================================
|
||||
@@ -52,14 +54,11 @@ Fog_Update
|
||||
update internal variables
|
||||
=============
|
||||
*/
|
||||
void Fog_Update (float density, float red, float green, float blue, float time)
|
||||
{
|
||||
void Fog_Update(float density, float red, float green, float blue, float time) {
|
||||
//save previous settings for fade
|
||||
if (time > 0)
|
||||
{
|
||||
if (time > 0) {
|
||||
//check for a fade in progress
|
||||
if (fade_done > cl.time)
|
||||
{
|
||||
if (fade_done > cl.time) {
|
||||
float f;
|
||||
|
||||
f = (fade_done - cl.time) / fade_time;
|
||||
@@ -67,9 +66,7 @@ void Fog_Update (float density, float red, float green, float blue, float time)
|
||||
old_red = f * old_red + (1.0 - f) * fog_red;
|
||||
old_green = f * old_green + (1.0 - f) * fog_green;
|
||||
old_blue = f * old_blue + (1.0 - f) * fog_blue;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
old_density = fog_density;
|
||||
old_red = fog_red;
|
||||
old_green = fog_green;
|
||||
@@ -92,8 +89,7 @@ Fog_ParseServerMessage
|
||||
handle an SVC_FOG message from server
|
||||
=============
|
||||
*/
|
||||
void Fog_ParseServerMessage (void)
|
||||
{
|
||||
void Fog_ParseServerMessage(void) {
|
||||
float density, red, green, blue, time;
|
||||
|
||||
density = MSG_ReadByte() / 255.0;
|
||||
@@ -103,7 +99,7 @@ void Fog_ParseServerMessage (void)
|
||||
time = MSG_ReadShort() / 100.0;
|
||||
if (time < 0.0f) time = 0.0f;
|
||||
|
||||
Fog_Update (density, red, green, blue, time);
|
||||
Fog_Update(density, red, green, blue, time);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -113,12 +109,10 @@ Fog_FogCommand_f
|
||||
handle the 'fog' console command
|
||||
=============
|
||||
*/
|
||||
void Fog_FogCommand_f (void)
|
||||
{
|
||||
void Fog_FogCommand_f(void) {
|
||||
float d, r, g, b, t;
|
||||
|
||||
switch (Cmd_Argc())
|
||||
{
|
||||
switch (command::argc()) {
|
||||
default:
|
||||
case 1:
|
||||
Con_Printf("usage:\n");
|
||||
@@ -132,15 +126,15 @@ void Fog_FogCommand_f (void)
|
||||
Con_Printf(" \"blue\" is \"%f\"\n", fog_blue);
|
||||
return;
|
||||
case 2:
|
||||
d = Q_atof(Cmd_Argv(1));
|
||||
d = Q_atof(command::argv(1)->c_str());
|
||||
t = 0.0f;
|
||||
r = fog_red;
|
||||
g = fog_green;
|
||||
b = fog_blue;
|
||||
break;
|
||||
case 3: //TEST
|
||||
d = Q_atof(Cmd_Argv(1));
|
||||
t = Q_atof(Cmd_Argv(2));
|
||||
d = Q_atof(command::argv(1)->c_str());
|
||||
t = Q_atof(command::argv(2)->c_str());
|
||||
r = fog_red;
|
||||
g = fog_green;
|
||||
b = fog_blue;
|
||||
@@ -148,23 +142,23 @@ void Fog_FogCommand_f (void)
|
||||
case 4:
|
||||
d = fog_density;
|
||||
t = 0.0f;
|
||||
r = Q_atof(Cmd_Argv(1));
|
||||
g = Q_atof(Cmd_Argv(2));
|
||||
b = Q_atof(Cmd_Argv(3));
|
||||
r = Q_atof(command::argv(1)->c_str());
|
||||
g = Q_atof(command::argv(2)->c_str());
|
||||
b = Q_atof(command::argv(3)->c_str());
|
||||
break;
|
||||
case 5:
|
||||
d = Q_atof(Cmd_Argv(1));
|
||||
r = Q_atof(Cmd_Argv(2));
|
||||
g = Q_atof(Cmd_Argv(3));
|
||||
b = Q_atof(Cmd_Argv(4));
|
||||
d = Q_atof(command::argv(1)->c_str());
|
||||
r = Q_atof(command::argv(2)->c_str());
|
||||
g = Q_atof(command::argv(3)->c_str());
|
||||
b = Q_atof(command::argv(4)->c_str());
|
||||
t = 0.0f;
|
||||
break;
|
||||
case 6: //TEST
|
||||
d = Q_atof(Cmd_Argv(1));
|
||||
r = Q_atof(Cmd_Argv(2));
|
||||
g = Q_atof(Cmd_Argv(3));
|
||||
b = Q_atof(Cmd_Argv(4));
|
||||
t = Q_atof(Cmd_Argv(5));
|
||||
d = Q_atof(command::argv(1)->c_str());
|
||||
r = Q_atof(command::argv(2)->c_str());
|
||||
g = Q_atof(command::argv(3)->c_str());
|
||||
b = Q_atof(command::argv(4)->c_str());
|
||||
t = Q_atof(command::argv(5)->c_str());
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -185,10 +179,9 @@ Fog_ParseWorldspawn
|
||||
called at map load
|
||||
=============
|
||||
*/
|
||||
void Fog_ParseWorldspawn (void)
|
||||
{
|
||||
char key[128], value[4096];
|
||||
const char *data;
|
||||
void Fog_ParseWorldspawn() {
|
||||
std::string key{};
|
||||
std::string value{};
|
||||
|
||||
//initially no fog
|
||||
fog_density = DEFAULT_DENSITY;
|
||||
@@ -204,32 +197,41 @@ void Fog_ParseWorldspawn (void)
|
||||
fade_time = 0.0;
|
||||
fade_done = 0.0;
|
||||
|
||||
data = COM_Parse(cl.worldmodel->entities);
|
||||
if (!data)
|
||||
return; // error
|
||||
if (com_token[0] != '{')
|
||||
return; // error
|
||||
while (1)
|
||||
{
|
||||
data = COM_Parse(data);
|
||||
if (!data)
|
||||
return; // error
|
||||
if (com_token[0] == '}')
|
||||
break; // end of worldspawn
|
||||
if (com_token[0] == '_')
|
||||
q_strlcpy(key, com_token + 1, sizeof(key));
|
||||
else
|
||||
q_strlcpy(key, com_token, sizeof(key));
|
||||
while (key[0] && key[strlen(key)-1] == ' ') // remove trailing spaces
|
||||
key[strlen(key)-1] = 0;
|
||||
data = COM_ParseEx(data, CPE_ALLOWTRUNC);
|
||||
if (!data)
|
||||
return; // error
|
||||
q_strlcpy(value, com_token, sizeof(value));
|
||||
std::istringstream ss{cl.worldmodel->entities};
|
||||
|
||||
if (!strcmp("fog", key))
|
||||
{
|
||||
sscanf(value, "%f %f %f %f", &fog_density, &fog_red, &fog_green, &fog_blue);
|
||||
auto token = common::parse_token(ss);
|
||||
if (!token.has_value()) {
|
||||
return; // error
|
||||
}
|
||||
if (token->front() != '{') {
|
||||
return; // error
|
||||
}
|
||||
while (true) {
|
||||
token = common::parse_token(ss);
|
||||
if (!token.has_value()) {
|
||||
return; // error
|
||||
}
|
||||
if (token->front() == '}') {
|
||||
break; // end of worldspawn
|
||||
}
|
||||
if (token->front() == '_') {
|
||||
key = token->substr(1);
|
||||
} else {
|
||||
key = token.value();
|
||||
}
|
||||
|
||||
while (!key.empty() && key.back() == ' ') {
|
||||
key.pop_back();
|
||||
}
|
||||
|
||||
token = common::parse_token(ss);
|
||||
if (!token.has_value()) {
|
||||
return; // error
|
||||
}
|
||||
value = token.value();
|
||||
|
||||
if (key == "fog") {
|
||||
std::sscanf(value.c_str(), "%f %f %f %f", &fog_density, &fog_red, &fog_green, &fog_blue);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -241,22 +243,18 @@ Fog_GetColor
|
||||
calculates fog color for this frame, taking into account fade times
|
||||
=============
|
||||
*/
|
||||
float *Fog_GetColor (void)
|
||||
{
|
||||
float *Fog_GetColor(void) {
|
||||
static float c[4];
|
||||
float f;
|
||||
int i;
|
||||
|
||||
if (fade_done > cl.time)
|
||||
{
|
||||
if (fade_done > cl.time) {
|
||||
f = (fade_done - cl.time) / fade_time;
|
||||
c[0] = f * old_red + (1.0 - f) * fog_red;
|
||||
c[1] = f * old_green + (1.0 - f) * fog_green;
|
||||
c[2] = f * old_blue + (1.0 - f) * fog_blue;
|
||||
c[3] = 1.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
c[0] = fog_red;
|
||||
c[1] = fog_green;
|
||||
c[2] = fog_blue;
|
||||
@@ -264,12 +262,12 @@ float *Fog_GetColor (void)
|
||||
}
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
c[i] = CLAMP (0.f, c[i], 1.f);
|
||||
c[i] = CLAMP(0.f, c[i], 1.f);
|
||||
}
|
||||
|
||||
//find closest 24-bit RGB value, so solid-colored sky can match the fog perfectly
|
||||
for (i = 0; i < 3; i++) {
|
||||
c[i] = (float)(Q_rint(c[i] * 255)) / 255.0f;
|
||||
c[i] = (float) (Q_rint(c[i] * 255)) / 255.0f;
|
||||
}
|
||||
|
||||
return c;
|
||||
@@ -282,16 +280,13 @@ Fog_GetDensity
|
||||
returns current density of fog
|
||||
=============
|
||||
*/
|
||||
float Fog_GetDensity (void)
|
||||
{
|
||||
float Fog_GetDensity(void) {
|
||||
float f;
|
||||
|
||||
if (fade_done > cl.time)
|
||||
{
|
||||
if (fade_done > cl.time) {
|
||||
f = (fade_done - cl.time) / fade_time;
|
||||
return f * old_density + (1.0 - f) * fog_density;
|
||||
}
|
||||
else
|
||||
} else
|
||||
return fog_density;
|
||||
}
|
||||
|
||||
@@ -302,8 +297,7 @@ Fog_SetupFrame
|
||||
called at the beginning of each frame
|
||||
=============
|
||||
*/
|
||||
void Fog_SetupFrame (void)
|
||||
{
|
||||
void Fog_SetupFrame(void) {
|
||||
glFogfv(GL_FOG_COLOR, Fog_GetColor());
|
||||
glFogf(GL_FOG_DENSITY, Fog_GetDensity() / 64.0);
|
||||
}
|
||||
@@ -315,8 +309,7 @@ Fog_EnableGFog
|
||||
called before drawing stuff that should be fogged
|
||||
=============
|
||||
*/
|
||||
void Fog_EnableGFog (void)
|
||||
{
|
||||
void Fog_EnableGFog(void) {
|
||||
if (Fog_GetDensity() > 0)
|
||||
glEnable(GL_FOG);
|
||||
}
|
||||
@@ -328,8 +321,7 @@ Fog_DisableGFog
|
||||
called after drawing stuff that should be fogged
|
||||
=============
|
||||
*/
|
||||
void Fog_DisableGFog (void)
|
||||
{
|
||||
void Fog_DisableGFog(void) {
|
||||
if (Fog_GetDensity() > 0)
|
||||
glDisable(GL_FOG);
|
||||
}
|
||||
@@ -341,9 +333,8 @@ Fog_StartAdditive
|
||||
called before drawing stuff that is additive blended -- sets fog color to black
|
||||
=============
|
||||
*/
|
||||
void Fog_StartAdditive (void)
|
||||
{
|
||||
vec3_t color = {0,0,0};
|
||||
void Fog_StartAdditive(void) {
|
||||
vec3_t color = {0, 0, 0};
|
||||
|
||||
if (Fog_GetDensity() > 0)
|
||||
glFogfv(GL_FOG_COLOR, color);
|
||||
@@ -356,8 +347,7 @@ Fog_StopAdditive
|
||||
called after drawing stuff that is additive blended -- restores fog color
|
||||
=============
|
||||
*/
|
||||
void Fog_StopAdditive (void)
|
||||
{
|
||||
void Fog_StopAdditive(void) {
|
||||
if (Fog_GetDensity() > 0)
|
||||
glFogfv(GL_FOG_COLOR, Fog_GetColor());
|
||||
}
|
||||
@@ -368,10 +358,13 @@ void Fog_StopAdditive (void)
|
||||
//
|
||||
//==============================================================================
|
||||
|
||||
cvar_t r_vfog = {"r_vfog", "1", CVAR_NONE};
|
||||
convar r_vfog{"r_vfog", "1"};
|
||||
|
||||
void Fog_DrawVFog (void){}
|
||||
void Fog_MarkModels (void){}
|
||||
void Fog_DrawVFog(void) {
|
||||
}
|
||||
|
||||
void Fog_MarkModels(void) {
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
//
|
||||
@@ -386,10 +379,9 @@ Fog_NewMap
|
||||
called whenever a map is loaded
|
||||
=============
|
||||
*/
|
||||
void Fog_NewMap (void)
|
||||
{
|
||||
Fog_ParseWorldspawn (); //for global fog
|
||||
Fog_MarkModels (); //for volumetric fog
|
||||
void Fog_NewMap(void) {
|
||||
Fog_ParseWorldspawn(); //for global fog
|
||||
Fog_MarkModels(); //for volumetric fog
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -399,11 +391,10 @@ Fog_Init
|
||||
called when quake initializes
|
||||
=============
|
||||
*/
|
||||
void Fog_Init (void)
|
||||
{
|
||||
Cmd_AddCommand ("fog",Fog_FogCommand_f);
|
||||
void Fog_Init(void) {
|
||||
command::add("fog", Fog_FogCommand_f);
|
||||
|
||||
//Cvar_RegisterVariable (&r_vfog);
|
||||
//r_vfog.inscribe();
|
||||
|
||||
//set up global fog
|
||||
fog_density = DEFAULT_DENSITY;
|
||||
@@ -411,7 +402,7 @@ void Fog_Init (void)
|
||||
fog_green = DEFAULT_GRAY;
|
||||
fog_blue = DEFAULT_GRAY;
|
||||
|
||||
Fog_SetupState ();
|
||||
Fog_SetupState();
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -421,7 +412,6 @@ Fog_SetupState
|
||||
ericw -- moved from Fog_Init, state that needs to be setup when a new context is created
|
||||
=============
|
||||
*/
|
||||
void Fog_SetupState (void)
|
||||
{
|
||||
void Fog_SetupState(void) {
|
||||
glFogi(GL_FOG_MODE, GL_EXP2);
|
||||
}
|
||||
|
||||
+16
-16
@@ -36,8 +36,8 @@ static qmodel_t *Mod_LoadModel (qmodel_t *mod, qboolean crash);
|
||||
|
||||
static void Mod_Print (void);
|
||||
|
||||
static cvar_t external_ents = {"external_ents", "1", CVAR_ARCHIVE};
|
||||
static cvar_t external_vis = {"external_vis", "1", CVAR_ARCHIVE};
|
||||
static convar external_ents = {"external_ents", "1", {.archive = true}};
|
||||
static convar external_vis = {"external_vis", "1", {.archive = true}};
|
||||
|
||||
static byte *mod_novis;
|
||||
static int mod_novis_capacity;
|
||||
@@ -59,11 +59,11 @@ Mod_Init
|
||||
*/
|
||||
void Mod_Init (void)
|
||||
{
|
||||
Cvar_RegisterVariable (&gl_subdivide_size);
|
||||
Cvar_RegisterVariable (&external_vis);
|
||||
Cvar_RegisterVariable (&external_ents);
|
||||
gl_subdivide_size.inscribe();
|
||||
external_vis.inscribe();
|
||||
external_ents.inscribe();
|
||||
|
||||
Cmd_AddCommand ("mcache", Mod_Print);
|
||||
command::add ("mcache", Mod_Print);
|
||||
|
||||
//johnfitz -- create notexture miptex
|
||||
r_notexture_mip = (texture_t *) Hunk_AllocName (sizeof(texture_t), "r_notexture_mip");
|
||||
@@ -525,7 +525,7 @@ static void Mod_LoadTextures (lump_t *l)
|
||||
if (((byte*)(mt+1) + pixels) > (mod_base + l->fileofs + l->filelen))
|
||||
{
|
||||
Con_DPrintf("Texture %s extends past end of lump\n", mt->name);
|
||||
pixels = q_max(0L, (long)((mod_base + l->fileofs + l->filelen) - (byte*)(mt+1)));
|
||||
pixels = std::max(0L, (long)((mod_base + l->fileofs + l->filelen) - (byte*)(mt+1)));
|
||||
}
|
||||
|
||||
tx->update_warp = false; //johnfitz
|
||||
@@ -2054,21 +2054,21 @@ static void Mod_BoundsFromClipNode (qmodel_t *mod, int hull, int nodenum)
|
||||
|
||||
case PLANE_X:
|
||||
if (plane->signbits == 1)
|
||||
mod->clipmins[0] = q_min(mod->clipmins[0], -plane->dist - mod->hulls[hull].clip_mins[0]);
|
||||
mod->clipmins[0] = std::min(mod->clipmins[0], -plane->dist - mod->hulls[hull].clip_mins[0]);
|
||||
else
|
||||
mod->clipmaxs[0] = q_max(mod->clipmaxs[0], plane->dist - mod->hulls[hull].clip_maxs[0]);
|
||||
mod->clipmaxs[0] = std::max(mod->clipmaxs[0], plane->dist - mod->hulls[hull].clip_maxs[0]);
|
||||
break;
|
||||
case PLANE_Y:
|
||||
if (plane->signbits == 2)
|
||||
mod->clipmins[1] = q_min(mod->clipmins[1], -plane->dist - mod->hulls[hull].clip_mins[1]);
|
||||
mod->clipmins[1] = std::min(mod->clipmins[1], -plane->dist - mod->hulls[hull].clip_mins[1]);
|
||||
else
|
||||
mod->clipmaxs[1] = q_max(mod->clipmaxs[1], plane->dist - mod->hulls[hull].clip_maxs[1]);
|
||||
mod->clipmaxs[1] = std::max(mod->clipmaxs[1], plane->dist - mod->hulls[hull].clip_maxs[1]);
|
||||
break;
|
||||
case PLANE_Z:
|
||||
if (plane->signbits == 4)
|
||||
mod->clipmins[2] = q_min(mod->clipmins[2], -plane->dist - mod->hulls[hull].clip_mins[2]);
|
||||
mod->clipmins[2] = std::min(mod->clipmins[2], -plane->dist - mod->hulls[hull].clip_mins[2]);
|
||||
else
|
||||
mod->clipmaxs[2] = q_max(mod->clipmaxs[2], plane->dist - mod->hulls[hull].clip_maxs[2]);
|
||||
mod->clipmaxs[2] = std::max(mod->clipmaxs[2], plane->dist - mod->hulls[hull].clip_maxs[2]);
|
||||
break;
|
||||
default:
|
||||
//skip nonaxial planes; don't need them
|
||||
@@ -2648,8 +2648,8 @@ static void Mod_CalcAliasBounds (aliashdr_t *a)
|
||||
|
||||
for (k=0; k<3;k++)
|
||||
{
|
||||
loadmodel->mins[k] = q_min(loadmodel->mins[k], v[k]);
|
||||
loadmodel->maxs[k] = q_max(loadmodel->maxs[k], v[k]);
|
||||
loadmodel->mins[k] = std::min(loadmodel->mins[k], v[k]);
|
||||
loadmodel->maxs[k] = std::max(loadmodel->maxs[k], v[k]);
|
||||
}
|
||||
dist = v[0] * v[0] + v[1] * v[1];
|
||||
if (yawradius < dist)
|
||||
@@ -2711,7 +2711,7 @@ Mod_SetExtraFlags -- johnfitz -- set up extra flags that aren't in the mdl
|
||||
*/
|
||||
void Mod_SetExtraFlags (qmodel_t *mod)
|
||||
{
|
||||
extern cvar_t r_nolerp_list, r_noshadow_list;
|
||||
extern convar r_nolerp_list, r_noshadow_list;
|
||||
|
||||
if (!mod || mod->type != mod_alias)
|
||||
return;
|
||||
|
||||
+1
-1
@@ -155,7 +155,7 @@ void R_CheckEfrags (void)
|
||||
Con_DWarning ("%i efrags exceeds standard limit of 640.\n", cl.num_efrags);
|
||||
|
||||
dev_stats.efrags = cl.num_efrags;
|
||||
dev_peakstats.efrags = q_max(cl.num_efrags, dev_peakstats.efrags);
|
||||
dev_peakstats.efrags = std::max(cl.num_efrags, dev_peakstats.efrags);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
+2
-2
@@ -25,7 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
static int r_dlightframecount;
|
||||
|
||||
extern cvar_t r_flatlightstyles; //johnfitz
|
||||
extern convar r_flatlightstyles; //johnfitz
|
||||
|
||||
/*
|
||||
==================
|
||||
@@ -359,7 +359,7 @@ loc0:
|
||||
// caused by overlapping surfaces with mixed lighting data.
|
||||
const float nearby = 8.f;
|
||||
dist += nearby;
|
||||
*maxdist = q_min(*maxdist, dist);
|
||||
*maxdist = std::min(*maxdist, dist);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
+359
-420
File diff suppressed because it is too large
Load Diff
+235
-259
@@ -22,35 +22,37 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
// r_misc.c
|
||||
|
||||
#include <sstream>
|
||||
|
||||
#include "quakedef.hpp"
|
||||
|
||||
//johnfitz -- new cvars
|
||||
extern cvar_t r_stereo;
|
||||
extern cvar_t r_stereodepth;
|
||||
extern cvar_t r_clearcolor;
|
||||
extern cvar_t r_drawflat;
|
||||
extern cvar_t r_flatlightstyles;
|
||||
extern cvar_t gl_fullbrights;
|
||||
extern cvar_t gl_farclip;
|
||||
extern cvar_t gl_overbright;
|
||||
extern cvar_t gl_overbright_models;
|
||||
extern cvar_t r_waterquality;
|
||||
extern cvar_t r_oldwater;
|
||||
extern cvar_t r_waterwarp;
|
||||
extern cvar_t r_oldskyleaf;
|
||||
extern cvar_t r_drawworld;
|
||||
extern cvar_t r_showtris;
|
||||
extern cvar_t r_showbboxes;
|
||||
extern cvar_t r_lerpmodels;
|
||||
extern cvar_t r_lerpmove;
|
||||
extern cvar_t r_nolerp_list;
|
||||
extern cvar_t r_noshadow_list;
|
||||
extern convar r_stereo;
|
||||
extern convar r_stereodepth;
|
||||
extern convar r_clearcolor;
|
||||
extern convar r_drawflat;
|
||||
extern convar r_flatlightstyles;
|
||||
extern convar gl_fullbrights;
|
||||
extern convar gl_farclip;
|
||||
extern convar gl_overbright;
|
||||
extern convar gl_overbright_models;
|
||||
extern convar r_waterquality;
|
||||
extern convar r_oldwater;
|
||||
extern convar r_waterwarp;
|
||||
extern convar r_oldskyleaf;
|
||||
extern convar r_drawworld;
|
||||
extern convar r_showtris;
|
||||
extern convar r_showbboxes;
|
||||
extern convar r_lerpmodels;
|
||||
extern convar r_lerpmove;
|
||||
extern convar r_nolerp_list;
|
||||
extern convar r_noshadow_list;
|
||||
//johnfitz
|
||||
extern cvar_t gl_zfix; // QuakeSpasm z-fighting fix
|
||||
extern convar gl_zfix; // QuakeSpasm z-fighting fix
|
||||
|
||||
extern gltexture_t *playertextures[MAX_SCOREBOARD]; //johnfitz
|
||||
|
||||
cvar_t r_lightmapwide = {"r_lightmapwide","0",CVAR_ROM};
|
||||
convar r_lightmapwide = {"r_lightmapwide", "0", {.rom = true}};
|
||||
|
||||
|
||||
/*
|
||||
@@ -58,9 +60,8 @@ cvar_t r_lightmapwide = {"r_lightmapwide","0",CVAR_ROM};
|
||||
GL_Overbright_f -- johnfitz
|
||||
====================
|
||||
*/
|
||||
static void GL_Overbright_f (cvar_t *var)
|
||||
{
|
||||
R_RebuildAllLightmaps ();
|
||||
static void GL_Overbright_f(convar *var) {
|
||||
R_RebuildAllLightmaps();
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -68,9 +69,8 @@ static void GL_Overbright_f (cvar_t *var)
|
||||
GL_Fullbrights_f -- johnfitz
|
||||
====================
|
||||
*/
|
||||
static void GL_Fullbrights_f (cvar_t *var)
|
||||
{
|
||||
TexMgr_ReloadNobrightImages ();
|
||||
static void GL_Fullbrights_f(convar *var) {
|
||||
TexMgr_ReloadNobrightImages();
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -78,14 +78,13 @@ static void GL_Fullbrights_f (cvar_t *var)
|
||||
R_SetClearColor_f -- johnfitz
|
||||
====================
|
||||
*/
|
||||
static void R_SetClearColor_f (cvar_t *var)
|
||||
{
|
||||
static void R_SetClearColor_f(convar *var) {
|
||||
byte *rgb;
|
||||
int s;
|
||||
|
||||
s = (int)r_clearcolor.value & 0xFF;
|
||||
rgb = (byte*)(d_8to24table + s);
|
||||
glClearColor (rgb[0]/255.0,rgb[1]/255.0,rgb[2]/255.0,0);
|
||||
s = (int) r_clearcolor.value & 0xFF;
|
||||
rgb = (byte *) (d_8to24table + s);
|
||||
glClearColor(rgb[0] / 255.0, rgb[1] / 255.0, rgb[2] / 255.0, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -93,11 +92,10 @@ static void R_SetClearColor_f (cvar_t *var)
|
||||
R_Model_ExtraFlags_List_f -- johnfitz -- called when r_nolerp_list or r_noshadow_list cvar changes
|
||||
===============
|
||||
*/
|
||||
static void R_Model_ExtraFlags_List_f (cvar_t *var)
|
||||
{
|
||||
static void R_Model_ExtraFlags_List_f(convar *var) {
|
||||
int i;
|
||||
for (i=0; i < MAX_MODELS; i++)
|
||||
Mod_SetExtraFlags (cl.model_precache[i]);
|
||||
for (i = 0; i < MAX_MODELS; i++)
|
||||
Mod_SetExtraFlags(cl.model_precache[i]);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -105,8 +103,7 @@ static void R_Model_ExtraFlags_List_f (cvar_t *var)
|
||||
R_SetWateralpha_f -- ericw
|
||||
====================
|
||||
*/
|
||||
static void R_SetWateralpha_f (cvar_t *var)
|
||||
{
|
||||
static void R_SetWateralpha_f(convar *var) {
|
||||
map_wateralpha = var->value;
|
||||
}
|
||||
|
||||
@@ -115,8 +112,7 @@ static void R_SetWateralpha_f (cvar_t *var)
|
||||
R_SetLavaalpha_f -- ericw
|
||||
====================
|
||||
*/
|
||||
static void R_SetLavaalpha_f (cvar_t *var)
|
||||
{
|
||||
static void R_SetLavaalpha_f(convar *var) {
|
||||
map_lavaalpha = var->value;
|
||||
}
|
||||
|
||||
@@ -125,8 +121,7 @@ static void R_SetLavaalpha_f (cvar_t *var)
|
||||
R_SetTelealpha_f -- ericw
|
||||
====================
|
||||
*/
|
||||
static void R_SetTelealpha_f (cvar_t *var)
|
||||
{
|
||||
static void R_SetTelealpha_f(convar *var) {
|
||||
map_telealpha = var->value;
|
||||
}
|
||||
|
||||
@@ -135,8 +130,7 @@ static void R_SetTelealpha_f (cvar_t *var)
|
||||
R_SetSlimealpha_f -- ericw
|
||||
====================
|
||||
*/
|
||||
static void R_SetSlimealpha_f (cvar_t *var)
|
||||
{
|
||||
static void R_SetSlimealpha_f(convar *var) {
|
||||
map_slimealpha = var->value;
|
||||
}
|
||||
|
||||
@@ -145,8 +139,7 @@ static void R_SetSlimealpha_f (cvar_t *var)
|
||||
GL_WaterAlphaForSurfface -- ericw
|
||||
====================
|
||||
*/
|
||||
float GL_WaterAlphaForSurface (msurface_t *fa)
|
||||
{
|
||||
float GL_WaterAlphaForSurface(msurface_t *fa) {
|
||||
if (fa->flags & SURF_DRAWLAVA)
|
||||
return map_lavaalpha > 0 ? map_lavaalpha : map_wateralpha;
|
||||
else if (fa->flags & SURF_DRAWTELE)
|
||||
@@ -163,79 +156,78 @@ float GL_WaterAlphaForSurface (msurface_t *fa)
|
||||
R_Init
|
||||
===============
|
||||
*/
|
||||
void R_Init (void)
|
||||
{
|
||||
Cmd_AddCommand ("timerefresh", R_TimeRefresh_f);
|
||||
Cmd_AddCommand ("pointfile", R_ReadPointFile_f);
|
||||
void R_Init(void) {
|
||||
command::add("timerefresh", R_TimeRefresh_f);
|
||||
command::add("pointfile", R_ReadPointFile_f);
|
||||
|
||||
Cvar_RegisterVariable (&r_norefresh);
|
||||
Cvar_RegisterVariable (&r_lightmap);
|
||||
Cvar_RegisterVariable (&r_fullbright);
|
||||
Cvar_RegisterVariable (&r_drawentities);
|
||||
Cvar_RegisterVariable (&r_drawviewmodel);
|
||||
Cvar_RegisterVariable (&r_shadows);
|
||||
Cvar_RegisterVariable (&r_wateralpha);
|
||||
Cvar_SetCallback (&r_wateralpha, R_SetWateralpha_f);
|
||||
Cvar_RegisterVariable (&r_litwater);
|
||||
Cvar_RegisterVariable (&r_dynamic);
|
||||
Cvar_RegisterVariable (&r_novis);
|
||||
Cvar_RegisterVariable (&r_speeds);
|
||||
Cvar_RegisterVariable (&r_pos);
|
||||
r_norefresh.inscribe();
|
||||
r_lightmap.inscribe();
|
||||
r_fullbright.inscribe();
|
||||
r_drawentities.inscribe();
|
||||
r_drawviewmodel.inscribe();
|
||||
r_shadows.inscribe();
|
||||
r_wateralpha.inscribe();
|
||||
r_wateralpha.set_callback(R_SetWateralpha_f);
|
||||
r_litwater.inscribe();
|
||||
r_dynamic.inscribe();
|
||||
r_novis.inscribe();
|
||||
r_speeds.inscribe();
|
||||
r_pos.inscribe();
|
||||
|
||||
Cvar_RegisterVariable (&gl_finish);
|
||||
Cvar_RegisterVariable (&gl_clear);
|
||||
Cvar_RegisterVariable (&gl_cull);
|
||||
Cvar_RegisterVariable (&gl_smoothmodels);
|
||||
Cvar_RegisterVariable (&gl_affinemodels);
|
||||
Cvar_RegisterVariable (&gl_polyblend);
|
||||
Cvar_RegisterVariable (&gl_flashblend);
|
||||
Cvar_RegisterVariable (&gl_playermip);
|
||||
Cvar_RegisterVariable (&gl_nocolors);
|
||||
gl_finish.inscribe();
|
||||
gl_clear.inscribe();
|
||||
gl_cull.inscribe();
|
||||
gl_smoothmodels.inscribe();
|
||||
gl_affinemodels.inscribe();
|
||||
gl_polyblend.inscribe();
|
||||
gl_flashblend.inscribe();
|
||||
gl_playermip.inscribe();
|
||||
gl_nocolors.inscribe();
|
||||
|
||||
//johnfitz -- new cvars
|
||||
Cvar_RegisterVariable (&r_stereo);
|
||||
Cvar_RegisterVariable (&r_stereodepth);
|
||||
Cvar_RegisterVariable (&r_clearcolor);
|
||||
Cvar_SetCallback (&r_clearcolor, R_SetClearColor_f);
|
||||
Cvar_RegisterVariable (&r_waterquality);
|
||||
Cvar_RegisterVariable (&r_oldwater);
|
||||
Cvar_RegisterVariable (&r_waterwarp);
|
||||
Cvar_RegisterVariable (&r_drawflat);
|
||||
Cvar_RegisterVariable (&r_flatlightstyles);
|
||||
Cvar_RegisterVariable (&r_oldskyleaf);
|
||||
Cvar_RegisterVariable (&r_drawworld);
|
||||
Cvar_RegisterVariable (&r_showtris);
|
||||
Cvar_RegisterVariable (&r_showbboxes);
|
||||
Cvar_RegisterVariable (&gl_farclip);
|
||||
Cvar_RegisterVariable (&gl_fullbrights);
|
||||
Cvar_RegisterVariable (&gl_overbright);
|
||||
Cvar_SetCallback (&gl_fullbrights, GL_Fullbrights_f);
|
||||
Cvar_SetCallback (&gl_overbright, GL_Overbright_f);
|
||||
Cvar_RegisterVariable (&gl_overbright_models);
|
||||
Cvar_RegisterVariable (&r_lerpmodels);
|
||||
Cvar_RegisterVariable (&r_lerpmove);
|
||||
Cvar_RegisterVariable (&r_nolerp_list);
|
||||
Cvar_SetCallback (&r_nolerp_list, R_Model_ExtraFlags_List_f);
|
||||
Cvar_RegisterVariable (&r_noshadow_list);
|
||||
Cvar_SetCallback (&r_noshadow_list, R_Model_ExtraFlags_List_f);
|
||||
r_stereo.inscribe();
|
||||
r_stereodepth.inscribe();
|
||||
r_clearcolor.inscribe();
|
||||
r_clearcolor.set_callback(R_SetClearColor_f);
|
||||
r_waterquality.inscribe();
|
||||
r_oldwater.inscribe();
|
||||
r_waterwarp.inscribe();
|
||||
r_drawflat.inscribe();
|
||||
r_flatlightstyles.inscribe();
|
||||
r_oldskyleaf.inscribe();
|
||||
r_drawworld.inscribe();
|
||||
r_showtris.inscribe();
|
||||
r_showbboxes.inscribe();
|
||||
gl_farclip.inscribe();
|
||||
gl_fullbrights.inscribe();
|
||||
gl_overbright.inscribe();
|
||||
gl_fullbrights.set_callback(GL_Fullbrights_f);
|
||||
gl_overbright.set_callback(GL_Overbright_f);
|
||||
gl_overbright_models.inscribe();
|
||||
r_lerpmodels.inscribe();
|
||||
r_lerpmove.inscribe();
|
||||
r_nolerp_list.inscribe();
|
||||
r_nolerp_list.set_callback(R_Model_ExtraFlags_List_f);
|
||||
r_noshadow_list.inscribe();
|
||||
r_noshadow_list.set_callback(R_Model_ExtraFlags_List_f);
|
||||
//johnfitz
|
||||
Cvar_RegisterVariable (&r_lightmapwide);
|
||||
Cvar_SetROM ("r_lightmapwide", gl_packed_pixels ? "1" : "0");
|
||||
r_lightmapwide.inscribe();
|
||||
convar::set_rom("r_lightmapwide", gl_packed_pixels ? "1" : "0");
|
||||
|
||||
Cvar_RegisterVariable (&gl_zfix); // QuakeSpasm z-fighting fix
|
||||
Cvar_RegisterVariable (&r_lavaalpha);
|
||||
Cvar_RegisterVariable (&r_telealpha);
|
||||
Cvar_RegisterVariable (&r_slimealpha);
|
||||
Cvar_RegisterVariable (&r_scale);
|
||||
Cvar_SetCallback (&r_lavaalpha, R_SetLavaalpha_f);
|
||||
Cvar_SetCallback (&r_telealpha, R_SetTelealpha_f);
|
||||
Cvar_SetCallback (&r_slimealpha, R_SetSlimealpha_f);
|
||||
gl_zfix.inscribe(); // QuakeSpasm z-fighting fix
|
||||
r_lavaalpha.inscribe();
|
||||
r_telealpha.inscribe();
|
||||
r_slimealpha.inscribe();
|
||||
r_scale.inscribe();
|
||||
r_lavaalpha.set_callback(R_SetLavaalpha_f);
|
||||
r_telealpha.set_callback(R_SetTelealpha_f);
|
||||
r_slimealpha.set_callback(R_SetSlimealpha_f);
|
||||
|
||||
R_InitParticles ();
|
||||
R_SetClearColor_f (&r_clearcolor); //johnfitz
|
||||
R_InitParticles();
|
||||
R_SetClearColor_f(&r_clearcolor); //johnfitz
|
||||
|
||||
Sky_Init (); //johnfitz
|
||||
Fog_Init (); //johnfitz
|
||||
Sky_Init(); //johnfitz
|
||||
Fog_Init(); //johnfitz
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -243,18 +235,16 @@ void R_Init (void)
|
||||
R_TranslatePlayerSkin -- johnfitz -- rewritten. also, only handles new colors, not new skins
|
||||
===============
|
||||
*/
|
||||
void R_TranslatePlayerSkin (int playernum)
|
||||
{
|
||||
void R_TranslatePlayerSkin(int playernum) {
|
||||
int top, bottom;
|
||||
|
||||
top = (cl.scores[playernum].colors & 0xf0)>>4;
|
||||
bottom = cl.scores[playernum].colors &15;
|
||||
top = (cl.scores[playernum].colors & 0xf0) >> 4;
|
||||
bottom = cl.scores[playernum].colors & 15;
|
||||
|
||||
//FIXME: if gl_nocolors is on, then turned off, the textures may be out of sync with the scoreboard colors.
|
||||
if (!gl_nocolors.value)
|
||||
{
|
||||
if (!gl_nocolors.value) {
|
||||
if (playertextures[playernum])
|
||||
TexMgr_ReloadImage (playertextures[playernum], top, bottom);
|
||||
TexMgr_ReloadImage(playertextures[playernum], top, bottom);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -265,39 +255,40 @@ the skin or model actually changes, instead of just new colors
|
||||
added bug fix from bengt jardup
|
||||
===============
|
||||
*/
|
||||
void R_TranslateNewPlayerSkin (int playernum)
|
||||
{
|
||||
void R_TranslateNewPlayerSkin(int playernum) {
|
||||
char name[64];
|
||||
byte *pixels;
|
||||
aliashdr_t *paliashdr;
|
||||
int skinnum;
|
||||
|
||||
//get correct texture pixels
|
||||
currententity = &cl_entities[1+playernum];
|
||||
//get correct texture pixels
|
||||
currententity = &cl_entities[1 + playernum];
|
||||
|
||||
if (!currententity->model || currententity->model->type != mod_alias)
|
||||
return;
|
||||
|
||||
paliashdr = (aliashdr_t *)Mod_Extradata (currententity->model);
|
||||
paliashdr = (aliashdr_t *) Mod_Extradata(currententity->model);
|
||||
|
||||
skinnum = currententity->skinnum;
|
||||
|
||||
//TODO: move these tests to the place where skinnum gets received from the server
|
||||
if (skinnum < 0 || skinnum >= paliashdr->numskins)
|
||||
{
|
||||
if (skinnum < 0 || skinnum >= paliashdr->numskins) {
|
||||
Con_DPrintf("(%d): Invalid player skin #%d\n", playernum, skinnum);
|
||||
skinnum = 0;
|
||||
}
|
||||
|
||||
pixels = (byte *)paliashdr + paliashdr->texels[skinnum]; // This is not a persistent place!
|
||||
pixels = (byte *) paliashdr + paliashdr->texels[skinnum]; // This is not a persistent place!
|
||||
|
||||
//upload new image
|
||||
//upload new image
|
||||
q_snprintf(name, sizeof(name), "player_%i", playernum);
|
||||
playertextures[playernum] = TexMgr_LoadImage (currententity->model, name, paliashdr->skinwidth, paliashdr->skinheight,
|
||||
SRC_INDEXED, pixels, paliashdr->gltextures[skinnum][0]->source_file, paliashdr->gltextures[skinnum][0]->source_offset, TEXPREF_PAD | TEXPREF_OVERWRITE);
|
||||
playertextures[playernum] = TexMgr_LoadImage(currententity->model, name, paliashdr->skinwidth,
|
||||
paliashdr->skinheight,
|
||||
SRC_INDEXED, pixels, paliashdr->gltextures[skinnum][0]->source_file,
|
||||
paliashdr->gltextures[skinnum][0]->source_offset,
|
||||
TEXPREF_PAD | TEXPREF_OVERWRITE);
|
||||
|
||||
//now recolor it
|
||||
R_TranslatePlayerSkin (playernum);
|
||||
//now recolor it
|
||||
R_TranslatePlayerSkin(playernum);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -305,12 +296,11 @@ void R_TranslateNewPlayerSkin (int playernum)
|
||||
R_NewGame -- johnfitz -- handle a game switch
|
||||
===============
|
||||
*/
|
||||
void R_NewGame (void)
|
||||
{
|
||||
void R_NewGame(void) {
|
||||
int i;
|
||||
|
||||
//clear playertexture pointers (the textures themselves were freed by texmgr_newgame)
|
||||
for (i=0; i<MAX_SCOREBOARD; i++)
|
||||
for (i = 0; i < MAX_SCOREBOARD; i++)
|
||||
playertextures[i] = NULL;
|
||||
}
|
||||
|
||||
@@ -321,51 +311,60 @@ R_ParseWorldspawn
|
||||
called at map load
|
||||
=============
|
||||
*/
|
||||
static void R_ParseWorldspawn (void)
|
||||
{
|
||||
char key[128], value[4096];
|
||||
const char *data;
|
||||
|
||||
static void R_ParseWorldspawn() {
|
||||
map_wateralpha = r_wateralpha.value;
|
||||
map_lavaalpha = r_lavaalpha.value;
|
||||
map_telealpha = r_telealpha.value;
|
||||
map_slimealpha = r_slimealpha.value;
|
||||
|
||||
data = COM_Parse(cl.worldmodel->entities);
|
||||
if (!data)
|
||||
std::string key{};
|
||||
std::string value{};
|
||||
std::istringstream ss{cl.worldmodel->entities};
|
||||
|
||||
auto token = common::parse_token(ss);
|
||||
if (!token.has_value())
|
||||
return; // error
|
||||
if (com_token[0] != '{')
|
||||
if ((*token)[0] != '{')
|
||||
return; // error
|
||||
|
||||
while (1)
|
||||
{
|
||||
data = COM_Parse(data);
|
||||
if (!data)
|
||||
while (true) {
|
||||
token = common::parse_token(ss);
|
||||
if (!token.has_value()) {
|
||||
return; // error
|
||||
if (com_token[0] == '}')
|
||||
}
|
||||
if ((*token)[0] == '}') {
|
||||
break; // end of worldspawn
|
||||
if (com_token[0] == '_')
|
||||
q_strlcpy(key, com_token + 1, sizeof(key));
|
||||
else
|
||||
q_strlcpy(key, com_token, sizeof(key));
|
||||
while (key[0] && key[strlen(key)-1] == ' ') // remove trailing spaces
|
||||
key[strlen(key)-1] = 0;
|
||||
data = COM_ParseEx(data, CPE_ALLOWTRUNC);
|
||||
if (!data)
|
||||
}
|
||||
if ((*token)[0] == '_') {
|
||||
key = token->substr(1);
|
||||
} else {
|
||||
key = *token;
|
||||
}
|
||||
while (!key.empty() && key.back() == ' ') {
|
||||
// remove trailing spaces
|
||||
key.pop_back();
|
||||
}
|
||||
token = common::parse_token(ss);
|
||||
if (!token.has_value()) {
|
||||
return; // error
|
||||
q_strlcpy(value, com_token, sizeof(value));
|
||||
}
|
||||
value = *token;
|
||||
|
||||
if (!strcmp("wateralpha", key))
|
||||
map_wateralpha = atof(value);
|
||||
if (key == "wateralpha") {
|
||||
map_wateralpha = std::strtof(value.c_str(), nullptr);
|
||||
}
|
||||
|
||||
if (!strcmp("lavaalpha", key))
|
||||
map_lavaalpha = atof(value);
|
||||
if (key == "lavaalpha") {
|
||||
map_lavaalpha = std::strtof(value.c_str(), nullptr);
|
||||
}
|
||||
|
||||
if (!strcmp("telealpha", key))
|
||||
map_telealpha = atof(value);
|
||||
if (key == "telealpha") {
|
||||
map_telealpha = std::strtof(value.c_str(), nullptr);
|
||||
}
|
||||
|
||||
if (!strcmp("slimealpha", key))
|
||||
map_slimealpha = atof(value);
|
||||
if (key == "slimealpha") {
|
||||
map_slimealpha = std::strtof(value.c_str(), nullptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -375,31 +374,30 @@ static void R_ParseWorldspawn (void)
|
||||
R_NewMap
|
||||
===============
|
||||
*/
|
||||
void R_NewMap (void)
|
||||
{
|
||||
void R_NewMap(void) {
|
||||
int i;
|
||||
|
||||
for (i=0 ; i<256 ; i++)
|
||||
for (i = 0; i < 256; i++)
|
||||
d_lightstylevalue[i] = 264; // normal light value
|
||||
|
||||
// clear out efrags in case the level hasn't been reloaded
|
||||
// FIXME: is this one short?
|
||||
for (i=0 ; i<cl.worldmodel->numleafs ; i++)
|
||||
// clear out efrags in case the level hasn't been reloaded
|
||||
// FIXME: is this one short?
|
||||
for (i = 0; i < cl.worldmodel->numleafs; i++)
|
||||
cl.worldmodel->leafs[i].efrags = NULL;
|
||||
|
||||
r_viewleaf = NULL;
|
||||
R_ClearParticles ();
|
||||
R_ClearParticles();
|
||||
|
||||
GL_BuildLightmaps ();
|
||||
GL_BuildBModelVertexBuffer ();
|
||||
GL_BuildLightmaps();
|
||||
GL_BuildBModelVertexBuffer();
|
||||
//ericw -- no longer load alias models into a VBO here, it's done in Mod_LoadAliasModel
|
||||
|
||||
r_framecount = 0; //johnfitz -- paranoid?
|
||||
r_visframecount = 0; //johnfitz -- paranoid?
|
||||
|
||||
Sky_NewMap (); //johnfitz -- skybox in worldspawn
|
||||
Fog_NewMap (); //johnfitz -- global fog in worldspawn
|
||||
R_ParseWorldspawn (); //ericw -- wateralpha, lavaalpha, telealpha, slimealpha in worldspawn
|
||||
Sky_NewMap(); //johnfitz -- skybox in worldspawn
|
||||
Fog_NewMap(); //johnfitz -- global fog in worldspawn
|
||||
R_ParseWorldspawn(); //ericw -- wateralpha, lavaalpha, telealpha, slimealpha in worldspawn
|
||||
|
||||
load_subdivide_size = gl_subdivide_size.value; //johnfitz -- is this the right place to set this?
|
||||
}
|
||||
@@ -411,71 +409,63 @@ R_TimeRefresh_f
|
||||
For program optimization
|
||||
====================
|
||||
*/
|
||||
void R_TimeRefresh_f (void)
|
||||
{
|
||||
void R_TimeRefresh_f(void) {
|
||||
int i;
|
||||
float start, stop, time;
|
||||
|
||||
if (cls.state != ca_connected)
|
||||
{
|
||||
if (cls.state != ca_connected) {
|
||||
Con_Printf("Not connected to a server\n");
|
||||
return;
|
||||
}
|
||||
|
||||
start = Sys_DoubleTime ();
|
||||
for (i = 0; i < 128; i++)
|
||||
{
|
||||
start = Sys_DoubleTime();
|
||||
for (i = 0; i < 128; i++) {
|
||||
GL_BeginRendering(&glx, &gly, &glwidth, &glheight);
|
||||
r_refdef.viewangles[1] = i/128.0*360.0;
|
||||
R_RenderView ();
|
||||
GL_EndRendering ();
|
||||
r_refdef.viewangles[1] = i / 128.0 * 360.0;
|
||||
R_RenderView();
|
||||
GL_EndRendering();
|
||||
}
|
||||
|
||||
glFinish ();
|
||||
stop = Sys_DoubleTime ();
|
||||
time = stop-start;
|
||||
Con_Printf ("%f seconds (%f fps)\n", time, 128/time);
|
||||
glFinish();
|
||||
stop = Sys_DoubleTime();
|
||||
time = stop - start;
|
||||
Con_Printf("%f seconds (%f fps)\n", time, 128 / time);
|
||||
}
|
||||
|
||||
void D_FlushCaches (void)
|
||||
{
|
||||
void D_FlushCaches(void) {
|
||||
}
|
||||
|
||||
static GLuint gl_programs[16];
|
||||
static int gl_num_programs;
|
||||
|
||||
static qboolean GL_CheckShader (GLuint shader)
|
||||
{
|
||||
static qboolean GL_CheckShader(GLuint shader) {
|
||||
GLint status;
|
||||
GL_GetShaderivFunc (shader, GL_COMPILE_STATUS, &status);
|
||||
GL_GetShaderivFunc(shader, GL_COMPILE_STATUS, &status);
|
||||
|
||||
if (status != GL_TRUE)
|
||||
{
|
||||
if (status != GL_TRUE) {
|
||||
char infolog[1024];
|
||||
|
||||
memset(infolog, 0, sizeof(infolog));
|
||||
GL_GetShaderInfoLogFunc (shader, sizeof(infolog), NULL, infolog);
|
||||
GL_GetShaderInfoLogFunc(shader, sizeof(infolog), NULL, infolog);
|
||||
|
||||
Con_Warning ("GLSL program failed to compile: %s", infolog);
|
||||
Con_Warning("GLSL program failed to compile: %s", infolog);
|
||||
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static qboolean GL_CheckProgram (GLuint program)
|
||||
{
|
||||
static qboolean GL_CheckProgram(GLuint program) {
|
||||
GLint status;
|
||||
GL_GetProgramivFunc (program, GL_LINK_STATUS, &status);
|
||||
GL_GetProgramivFunc(program, GL_LINK_STATUS, &status);
|
||||
|
||||
if (status != GL_TRUE)
|
||||
{
|
||||
if (status != GL_TRUE) {
|
||||
char infolog[1024];
|
||||
|
||||
memset(infolog, 0, sizeof(infolog));
|
||||
GL_GetProgramInfoLogFunc (program, sizeof(infolog), NULL, infolog);
|
||||
GL_GetProgramInfoLogFunc(program, sizeof(infolog), NULL, infolog);
|
||||
|
||||
Con_Warning ("GLSL program failed to link: %s", infolog);
|
||||
Con_Warning("GLSL program failed to link: %s", infolog);
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -487,16 +477,14 @@ static qboolean GL_CheckProgram (GLuint program)
|
||||
GL_GetUniformLocation
|
||||
=============
|
||||
*/
|
||||
GLint GL_GetUniformLocation (GLuint *programPtr, const char *name)
|
||||
{
|
||||
GLint GL_GetUniformLocation(GLuint *programPtr, const char *name) {
|
||||
GLint location;
|
||||
|
||||
if (!programPtr)
|
||||
return -1;
|
||||
|
||||
location = GL_GetUniformLocationFunc(*programPtr, name);
|
||||
if (location == -1)
|
||||
{
|
||||
if (location == -1) {
|
||||
Con_Warning("GL_GetUniformLocationFunc %s failed\n", name);
|
||||
*programPtr = 0;
|
||||
}
|
||||
@@ -510,55 +498,49 @@ GL_CreateProgram
|
||||
Compiles and returns GLSL program.
|
||||
====================
|
||||
*/
|
||||
GLuint GL_CreateProgram (const GLchar *vertSource, const GLchar *fragSource, int numbindings, const glsl_attrib_binding_t *bindings)
|
||||
{
|
||||
GLuint GL_CreateProgram(const GLchar *vertSource, const GLchar *fragSource, int numbindings,
|
||||
const glsl_attrib_binding_t *bindings) {
|
||||
int i;
|
||||
GLuint program, vertShader, fragShader;
|
||||
|
||||
if (!gl_glsl_able)
|
||||
return 0;
|
||||
|
||||
vertShader = GL_CreateShaderFunc (GL_VERTEX_SHADER);
|
||||
GL_ShaderSourceFunc (vertShader, 1, &vertSource, NULL);
|
||||
GL_CompileShaderFunc (vertShader);
|
||||
if (!GL_CheckShader (vertShader))
|
||||
{
|
||||
GL_DeleteShaderFunc (vertShader);
|
||||
vertShader = GL_CreateShaderFunc(GL_VERTEX_SHADER);
|
||||
GL_ShaderSourceFunc(vertShader, 1, &vertSource, NULL);
|
||||
GL_CompileShaderFunc(vertShader);
|
||||
if (!GL_CheckShader(vertShader)) {
|
||||
GL_DeleteShaderFunc(vertShader);
|
||||
return 0;
|
||||
}
|
||||
|
||||
fragShader = GL_CreateShaderFunc (GL_FRAGMENT_SHADER);
|
||||
GL_ShaderSourceFunc (fragShader, 1, &fragSource, NULL);
|
||||
GL_CompileShaderFunc (fragShader);
|
||||
if (!GL_CheckShader (fragShader))
|
||||
{
|
||||
GL_DeleteShaderFunc (vertShader);
|
||||
GL_DeleteShaderFunc (fragShader);
|
||||
fragShader = GL_CreateShaderFunc(GL_FRAGMENT_SHADER);
|
||||
GL_ShaderSourceFunc(fragShader, 1, &fragSource, NULL);
|
||||
GL_CompileShaderFunc(fragShader);
|
||||
if (!GL_CheckShader(fragShader)) {
|
||||
GL_DeleteShaderFunc(vertShader);
|
||||
GL_DeleteShaderFunc(fragShader);
|
||||
return 0;
|
||||
}
|
||||
|
||||
program = GL_CreateProgramFunc ();
|
||||
GL_AttachShaderFunc (program, vertShader);
|
||||
GL_DeleteShaderFunc (vertShader);
|
||||
GL_AttachShaderFunc (program, fragShader);
|
||||
GL_DeleteShaderFunc (fragShader);
|
||||
program = GL_CreateProgramFunc();
|
||||
GL_AttachShaderFunc(program, vertShader);
|
||||
GL_DeleteShaderFunc(vertShader);
|
||||
GL_AttachShaderFunc(program, fragShader);
|
||||
GL_DeleteShaderFunc(fragShader);
|
||||
|
||||
for (i = 0; i < numbindings; i++)
|
||||
{
|
||||
GL_BindAttribLocationFunc (program, bindings[i].attrib, bindings[i].name);
|
||||
for (i = 0; i < numbindings; i++) {
|
||||
GL_BindAttribLocationFunc(program, bindings[i].attrib, bindings[i].name);
|
||||
}
|
||||
|
||||
GL_LinkProgramFunc (program);
|
||||
GL_LinkProgramFunc(program);
|
||||
|
||||
if (!GL_CheckProgram (program))
|
||||
{
|
||||
GL_DeleteProgramFunc (program);
|
||||
if (!GL_CheckProgram(program)) {
|
||||
GL_DeleteProgramFunc(program);
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
if (gl_num_programs == Q_COUNTOF(gl_programs))
|
||||
Host_Error ("gl_programs overflow");
|
||||
Host_Error("gl_programs overflow");
|
||||
|
||||
gl_programs[gl_num_programs] = program;
|
||||
gl_num_programs++;
|
||||
@@ -574,16 +556,14 @@ R_DeleteShaders
|
||||
Deletes any GLSL programs that have been created.
|
||||
====================
|
||||
*/
|
||||
void R_DeleteShaders (void)
|
||||
{
|
||||
void R_DeleteShaders(void) {
|
||||
int i;
|
||||
|
||||
if (!gl_glsl_able)
|
||||
return;
|
||||
|
||||
for (i = 0; i < gl_num_programs; i++)
|
||||
{
|
||||
GL_DeleteProgramFunc (gl_programs[i]);
|
||||
for (i = 0; i < gl_num_programs; i++) {
|
||||
GL_DeleteProgramFunc(gl_programs[i]);
|
||||
gl_programs[i] = 0;
|
||||
}
|
||||
gl_num_programs = 0;
|
||||
@@ -598,15 +578,13 @@ GL_BindBuffer
|
||||
glBindBuffer wrapper
|
||||
====================
|
||||
*/
|
||||
void GL_BindBuffer (GLenum target, GLuint buffer)
|
||||
{
|
||||
void GL_BindBuffer(GLenum target, GLuint buffer) {
|
||||
GLuint *cache;
|
||||
|
||||
if (!gl_vbo_able)
|
||||
return;
|
||||
|
||||
switch (target)
|
||||
{
|
||||
switch (target) {
|
||||
case GL_ARRAY_BUFFER:
|
||||
cache = ¤t_array_buffer;
|
||||
break;
|
||||
@@ -614,14 +592,13 @@ void GL_BindBuffer (GLenum target, GLuint buffer)
|
||||
cache = ¤t_element_array_buffer;
|
||||
break;
|
||||
default:
|
||||
Host_Error("GL_BindBuffer: unsupported target %d", (int)target);
|
||||
Host_Error("GL_BindBuffer: unsupported target %d", (int) target);
|
||||
return;
|
||||
}
|
||||
|
||||
if (*cache != buffer)
|
||||
{
|
||||
if (*cache != buffer) {
|
||||
*cache = buffer;
|
||||
GL_BindBufferFunc (target, *cache);
|
||||
GL_BindBufferFunc(target, *cache);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -633,13 +610,12 @@ This must be called if you do anything that could make the cached bindings
|
||||
invalid (e.g. manually binding, destroying the context).
|
||||
====================
|
||||
*/
|
||||
void GL_ClearBufferBindings (void)
|
||||
{
|
||||
void GL_ClearBufferBindings(void) {
|
||||
if (!gl_vbo_able)
|
||||
return;
|
||||
|
||||
current_array_buffer = 0;
|
||||
current_element_array_buffer = 0;
|
||||
GL_BindBufferFunc (GL_ARRAY_BUFFER, 0);
|
||||
GL_BindBufferFunc (GL_ELEMENT_ARRAY_BUFFER, 0);
|
||||
GL_BindBufferFunc(GL_ARRAY_BUFFER, 0);
|
||||
GL_BindBufferFunc(GL_ELEMENT_ARRAY_BUFFER, 0);
|
||||
}
|
||||
|
||||
+64
-64
@@ -78,30 +78,30 @@ float scr_con_current;
|
||||
float scr_conlines; // lines of console to display
|
||||
|
||||
//johnfitz -- new cvars
|
||||
cvar_t scr_menuscale = {"scr_menuscale", "1", CVAR_ARCHIVE};
|
||||
cvar_t scr_sbarscale = {"scr_sbarscale", "1", CVAR_ARCHIVE};
|
||||
cvar_t scr_sbaralpha = {"scr_sbaralpha", "0.75", CVAR_ARCHIVE};
|
||||
cvar_t scr_conwidth = {"scr_conwidth", "0", CVAR_ARCHIVE};
|
||||
cvar_t scr_conscale = {"scr_conscale", "1", CVAR_ARCHIVE};
|
||||
cvar_t scr_crosshairscale = {"scr_crosshairscale", "1", CVAR_ARCHIVE};
|
||||
cvar_t scr_showfps = {"scr_showfps", "0", CVAR_NONE};
|
||||
cvar_t scr_clock = {"scr_clock", "0", CVAR_NONE};
|
||||
convar scr_menuscale = {"scr_menuscale", "1", {.archive = true}};
|
||||
convar scr_sbarscale = {"scr_sbarscale", "1", {.archive = true}};
|
||||
convar scr_sbaralpha = {"scr_sbaralpha", "0.75", {.archive = true}};
|
||||
convar scr_conwidth = {"scr_conwidth", "0", {.archive = true}};
|
||||
convar scr_conscale = {"scr_conscale", "1", {.archive = true}};
|
||||
convar scr_crosshairscale = {"scr_crosshairscale", "1", {.archive = true}};
|
||||
convar scr_showfps = {"scr_showfps", "0"};
|
||||
convar scr_clock = {"scr_clock", "0"};
|
||||
//johnfitz
|
||||
cvar_t scr_usekfont = {"scr_usekfont", "0", CVAR_NONE}; // 2021 re-release
|
||||
convar scr_usekfont = {"scr_usekfont", "0"}; // 2021 re-release
|
||||
|
||||
cvar_t scr_viewsize = {"viewsize","100", CVAR_ARCHIVE};
|
||||
cvar_t scr_fov = {"fov","90",CVAR_NONE}; // 10 - 170
|
||||
cvar_t scr_fov_adapt = {"fov_adapt","1",CVAR_ARCHIVE};
|
||||
cvar_t scr_conspeed = {"scr_conspeed","500",CVAR_ARCHIVE};
|
||||
cvar_t scr_centertime = {"scr_centertime","2",CVAR_NONE};
|
||||
cvar_t scr_showturtle = {"showturtle","0",CVAR_NONE};
|
||||
cvar_t scr_showpause = {"showpause","1",CVAR_NONE};
|
||||
cvar_t scr_printspeed = {"scr_printspeed","8",CVAR_NONE};
|
||||
cvar_t gl_triplebuffer = {"gl_triplebuffer", "1", CVAR_ARCHIVE};
|
||||
convar scr_viewsize = {"viewsize","100", {.archive = true}};
|
||||
convar scr_fov = {"fov","90"}; // 10 - 170
|
||||
convar scr_fov_adapt = {"fov_adapt","1",{.archive = true}};
|
||||
convar scr_conspeed = {"scr_conspeed","500",{.archive = true}};
|
||||
convar scr_centertime = {"scr_centertime","2"};
|
||||
convar scr_showturtle = {"showturtle","0"};
|
||||
convar scr_showpause = {"showpause","1"};
|
||||
convar scr_printspeed = {"scr_printspeed","8"};
|
||||
convar gl_triplebuffer = {"gl_triplebuffer", "1", {.archive = true}};
|
||||
|
||||
cvar_t cl_gun_fovscale = {"cl_gun_fovscale","1",CVAR_ARCHIVE}; // Qrack
|
||||
convar cl_gun_fovscale = {"cl_gun_fovscale","1",{.archive = true}}; // Qrack
|
||||
|
||||
extern cvar_t crosshair;
|
||||
extern convar crosshair;
|
||||
|
||||
qboolean scr_initialized; // ready to draw
|
||||
|
||||
@@ -291,15 +291,15 @@ static void SCR_CalcRefdef (void)
|
||||
|
||||
// bound viewsize
|
||||
if (scr_viewsize.value < 30)
|
||||
Cvar_SetQuick (&scr_viewsize, "30");
|
||||
scr_viewsize.set("30");
|
||||
if (scr_viewsize.value > 120)
|
||||
Cvar_SetQuick (&scr_viewsize, "120");
|
||||
scr_viewsize.set("120");
|
||||
|
||||
// bound fov
|
||||
if (scr_fov.value < 10)
|
||||
Cvar_SetQuick (&scr_fov, "10");
|
||||
scr_fov.set("10");
|
||||
if (scr_fov.value > 170)
|
||||
Cvar_SetQuick (&scr_fov, "170");
|
||||
scr_fov.set("170");
|
||||
|
||||
vid.recalc_refdef = 0;
|
||||
|
||||
@@ -314,12 +314,12 @@ static void SCR_CalcRefdef (void)
|
||||
else
|
||||
sb_lines = 48 * scale;
|
||||
|
||||
size = q_min(scr_viewsize.value, 100.f) / 100;
|
||||
size = std::min(scr_viewsize.value, 100.f) / 100;
|
||||
//johnfitz
|
||||
|
||||
//johnfitz -- rewrote this section
|
||||
r_refdef.vrect.width = q_max(glwidth * size, 96.0f); //no smaller than 96, for icons
|
||||
r_refdef.vrect.height = q_min((int)(glheight * size), glheight - sb_lines); //make room for sbar
|
||||
r_refdef.vrect.width = std::max(glwidth * size, 96.0f); //no smaller than 96, for icons
|
||||
r_refdef.vrect.height = std::min((int)(glheight * size), glheight - sb_lines); //make room for sbar
|
||||
r_refdef.vrect.x = (glwidth - r_refdef.vrect.width)/2;
|
||||
r_refdef.vrect.y = (glheight - sb_lines - r_refdef.vrect.height)/2;
|
||||
//johnfitz
|
||||
@@ -340,7 +340,7 @@ Keybinding command
|
||||
*/
|
||||
void SCR_SizeUp_f (void)
|
||||
{
|
||||
Cvar_SetValueQuick (&scr_viewsize, scr_viewsize.value+10);
|
||||
scr_viewsize.set_value(scr_viewsize.value+10);
|
||||
}
|
||||
|
||||
|
||||
@@ -353,10 +353,10 @@ Keybinding command
|
||||
*/
|
||||
void SCR_SizeDown_f (void)
|
||||
{
|
||||
Cvar_SetValueQuick (&scr_viewsize, scr_viewsize.value-10);
|
||||
scr_viewsize.set_value(scr_viewsize.value-10);
|
||||
}
|
||||
|
||||
static void SCR_Callback_refdef (cvar_t *var)
|
||||
static void SCR_Callback_refdef (convar *var)
|
||||
{
|
||||
vid.recalc_refdef = 1;
|
||||
}
|
||||
@@ -366,7 +366,7 @@ static void SCR_Callback_refdef (cvar_t *var)
|
||||
SCR_Conwidth_f -- johnfitz -- called when scr_conwidth or scr_conscale changes
|
||||
==================
|
||||
*/
|
||||
void SCR_Conwidth_f (cvar_t *var)
|
||||
void SCR_Conwidth_f (convar *var)
|
||||
{
|
||||
vid.recalc_refdef = 1;
|
||||
vid.conwidth = (scr_conwidth.value > 0) ? (int)scr_conwidth.value : (scr_conscale.value > 0) ? (int)(vid.width/scr_conscale.value) : vid.width;
|
||||
@@ -396,36 +396,36 @@ SCR_Init
|
||||
void SCR_Init (void)
|
||||
{
|
||||
//johnfitz -- new cvars
|
||||
Cvar_RegisterVariable (&scr_menuscale);
|
||||
Cvar_RegisterVariable (&scr_sbarscale);
|
||||
Cvar_SetCallback (&scr_sbaralpha, SCR_Callback_refdef);
|
||||
Cvar_RegisterVariable (&scr_sbaralpha);
|
||||
Cvar_SetCallback (&scr_conwidth, &SCR_Conwidth_f);
|
||||
Cvar_SetCallback (&scr_conscale, &SCR_Conwidth_f);
|
||||
Cvar_RegisterVariable (&scr_conwidth);
|
||||
Cvar_RegisterVariable (&scr_conscale);
|
||||
Cvar_RegisterVariable (&scr_crosshairscale);
|
||||
Cvar_RegisterVariable (&scr_showfps);
|
||||
Cvar_RegisterVariable (&scr_clock);
|
||||
scr_menuscale.inscribe();
|
||||
scr_sbarscale.inscribe();
|
||||
scr_sbaralpha.set_callback(SCR_Callback_refdef);
|
||||
scr_sbaralpha.inscribe();
|
||||
scr_conwidth.set_callback(&SCR_Conwidth_f);
|
||||
scr_conscale.set_callback(&SCR_Conwidth_f);
|
||||
scr_conwidth.inscribe();
|
||||
scr_conscale.inscribe();
|
||||
scr_crosshairscale.inscribe();
|
||||
scr_showfps.inscribe();
|
||||
scr_clock.inscribe();
|
||||
//johnfitz
|
||||
Cvar_RegisterVariable (&scr_usekfont); // 2021 re-release
|
||||
Cvar_SetCallback (&scr_fov, SCR_Callback_refdef);
|
||||
Cvar_SetCallback (&scr_fov_adapt, SCR_Callback_refdef);
|
||||
Cvar_SetCallback (&scr_viewsize, SCR_Callback_refdef);
|
||||
Cvar_RegisterVariable (&scr_fov);
|
||||
Cvar_RegisterVariable (&scr_fov_adapt);
|
||||
Cvar_RegisterVariable (&scr_viewsize);
|
||||
Cvar_RegisterVariable (&scr_conspeed);
|
||||
Cvar_RegisterVariable (&scr_showturtle);
|
||||
Cvar_RegisterVariable (&scr_showpause);
|
||||
Cvar_RegisterVariable (&scr_centertime);
|
||||
Cvar_RegisterVariable (&scr_printspeed);
|
||||
Cvar_RegisterVariable (&gl_triplebuffer);
|
||||
Cvar_RegisterVariable (&cl_gun_fovscale);
|
||||
scr_usekfont.inscribe(); // 2021 re-release
|
||||
scr_fov.set_callback(SCR_Callback_refdef);
|
||||
scr_fov_adapt.set_callback(SCR_Callback_refdef);
|
||||
scr_viewsize.set_callback(SCR_Callback_refdef);
|
||||
scr_fov.inscribe();
|
||||
scr_fov_adapt.inscribe();
|
||||
scr_viewsize.inscribe();
|
||||
scr_conspeed.inscribe();
|
||||
scr_showturtle.inscribe();
|
||||
scr_showpause.inscribe();
|
||||
scr_centertime.inscribe();
|
||||
scr_printspeed.inscribe();
|
||||
gl_triplebuffer.inscribe();
|
||||
cl_gun_fovscale.inscribe();
|
||||
|
||||
Cmd_AddCommand ("screenshot",SCR_ScreenShot_f);
|
||||
Cmd_AddCommand ("sizeup",SCR_SizeUp_f);
|
||||
Cmd_AddCommand ("sizedown",SCR_SizeDown_f);
|
||||
command::add ("screenshot",SCR_ScreenShot_f);
|
||||
command::add ("sizeup",SCR_SizeUp_f);
|
||||
command::add ("sizedown",SCR_SizeDown_f);
|
||||
|
||||
SCR_LoadPics (); //johnfitz
|
||||
|
||||
@@ -666,7 +666,7 @@ SCR_SetUpToDrawConsole
|
||||
void SCR_SetUpToDrawConsole (void)
|
||||
{
|
||||
//johnfitz -- let's hack away the problem of slow console when host_timescale is <0
|
||||
extern cvar_t host_timescale;
|
||||
extern convar host_timescale;
|
||||
float timescale, conspeed;
|
||||
//johnfitz
|
||||
|
||||
@@ -765,9 +765,9 @@ void SCR_ScreenShot_f (void)
|
||||
|
||||
Q_strncpy (ext, "png", sizeof(ext));
|
||||
|
||||
if (Cmd_Argc () >= 2)
|
||||
if (command::argc () >= 2)
|
||||
{
|
||||
const char *requested_ext = Cmd_Argv (1);
|
||||
const char *requested_ext = command::argv (1)->c_str();
|
||||
|
||||
if (!q_strcasecmp ("png", requested_ext)
|
||||
|| !q_strcasecmp ("tga", requested_ext)
|
||||
@@ -782,8 +782,8 @@ void SCR_ScreenShot_f (void)
|
||||
|
||||
// read quality as the 3rd param (only used for JPG)
|
||||
quality = 90;
|
||||
if (Cmd_Argc () >= 3)
|
||||
quality = Q_atoi (Cmd_Argv(2));
|
||||
if (command::argc () >= 3)
|
||||
quality = Q_atoi (command::argv(2)->c_str());
|
||||
if (quality < 1 || quality > 100)
|
||||
{
|
||||
SCR_ScreenShot_Usage ();
|
||||
|
||||
+55
-46
@@ -22,6 +22,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
//gl_sky.c
|
||||
|
||||
#include <sstream>
|
||||
|
||||
#include "quakedef.hpp"
|
||||
|
||||
#define MAX_CLIP_VERTS 64
|
||||
@@ -40,11 +42,11 @@ static char skybox_name[1024]; //name of current skybox, or "" if no skybox
|
||||
static gltexture_t *skybox_textures[6];
|
||||
static gltexture_t *solidskytexture, *alphaskytexture;
|
||||
|
||||
extern cvar_t gl_farclip;
|
||||
static cvar_t r_fastsky = {"r_fastsky", "0", CVAR_NONE};
|
||||
static cvar_t r_sky_quality = {"r_sky_quality", "12", CVAR_NONE};
|
||||
static cvar_t r_skyalpha = {"r_skyalpha", "1", CVAR_NONE};
|
||||
static cvar_t r_skyfog = {"r_skyfog","0.5",CVAR_NONE};
|
||||
extern convar gl_farclip;
|
||||
static convar r_fastsky{"r_fastsky", "0"};
|
||||
static convar r_sky_quality{"r_sky_quality", "12"};
|
||||
static convar r_skyalpha{"r_skyalpha", "1"};
|
||||
static convar r_skyfog{"r_skyfog","0.5"};
|
||||
|
||||
static const int skytexorder[6] = {0,2,1,3,4,5}; //for skybox
|
||||
|
||||
@@ -298,53 +300,60 @@ Sky_NewMap
|
||||
*/
|
||||
void Sky_NewMap (void)
|
||||
{
|
||||
char key[128], value[4096];
|
||||
const char *data;
|
||||
|
||||
skyfog = r_skyfog.value;
|
||||
|
||||
std::string key{};
|
||||
std::string value{};
|
||||
|
||||
//
|
||||
// read worldspawn (this is so ugly, and shouldn't it be done on the server?)
|
||||
//
|
||||
data = cl.worldmodel->entities;
|
||||
if (!data)
|
||||
std::istringstream ss{cl.worldmodel->entities};
|
||||
if (ss.eof())
|
||||
return; //FIXME: how could this possibly ever happen? -- if there's no
|
||||
// worldspawn then the sever wouldn't send the loadmap message to the client
|
||||
|
||||
data = COM_Parse(data);
|
||||
if (!data) //should never happen
|
||||
auto token = common::parse_token(ss);
|
||||
if (!token.has_value()) {
|
||||
//should never happen
|
||||
return; // error
|
||||
if (com_token[0] != '{') //should never happen
|
||||
}
|
||||
if (token->front() != '{') {
|
||||
//should never happen
|
||||
return; // error
|
||||
while (1)
|
||||
}
|
||||
while (true)
|
||||
{
|
||||
data = COM_Parse(data);
|
||||
if (!data)
|
||||
token = common::parse_token(ss);
|
||||
if (!token.has_value()) {
|
||||
return; // error
|
||||
if (com_token[0] == '}')
|
||||
}
|
||||
if (token->front() == '}') {
|
||||
break; // end of worldspawn
|
||||
if (com_token[0] == '_')
|
||||
q_strlcpy(key, com_token + 1, sizeof(key));
|
||||
else
|
||||
q_strlcpy(key, com_token, sizeof(key));
|
||||
while (key[0] && key[strlen(key)-1] == ' ') // remove trailing spaces
|
||||
key[strlen(key)-1] = 0;
|
||||
data = COM_ParseEx(data, CPE_ALLOWTRUNC);
|
||||
if (!data)
|
||||
}
|
||||
if (token->front() == '_') {
|
||||
key = token->substr(1);
|
||||
}
|
||||
else {
|
||||
key = token.value();
|
||||
}
|
||||
while (!key.empty() && key.back() == ' ') {
|
||||
key.pop_back();
|
||||
}
|
||||
|
||||
token = common::parse_token(ss);
|
||||
if (!token.has_value()) {
|
||||
return; // error
|
||||
q_strlcpy(value, com_token, sizeof(value));
|
||||
}
|
||||
value = token.value();
|
||||
|
||||
if (!strcmp("sky", key))
|
||||
Sky_LoadSkyBox(value);
|
||||
if (key == "sky" || key == "skyname" || key == "qlsky") {
|
||||
Sky_LoadSkyBox(value.c_str());
|
||||
}
|
||||
|
||||
if (!strcmp("skyfog", key))
|
||||
skyfog = atof(value);
|
||||
#if 1 /* also accept non-standard keys */
|
||||
else if (!strcmp("skyname", key)) //half-life
|
||||
Sky_LoadSkyBox(value);
|
||||
else if (!strcmp("qlsky", key)) //quake lives
|
||||
Sky_LoadSkyBox(value);
|
||||
#endif
|
||||
if (key == "skyfog") {
|
||||
skyfog = std::strtof(value.c_str(), nullptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -355,13 +364,13 @@ Sky_SkyCommand_f
|
||||
*/
|
||||
void Sky_SkyCommand_f (void)
|
||||
{
|
||||
switch (Cmd_Argc())
|
||||
switch (command::argc())
|
||||
{
|
||||
case 1:
|
||||
Con_Printf("\"sky\" is \"%s\"\n", skybox_name);
|
||||
break;
|
||||
case 2:
|
||||
Sky_LoadSkyBox(Cmd_Argv(1));
|
||||
Sky_LoadSkyBox(command::argv(1)->c_str());
|
||||
break;
|
||||
default:
|
||||
Con_Printf("usage: sky <skyname>\n");
|
||||
@@ -373,7 +382,7 @@ void Sky_SkyCommand_f (void)
|
||||
R_SetSkyfog_f -- ericw
|
||||
====================
|
||||
*/
|
||||
static void R_SetSkyfog_f (cvar_t *var)
|
||||
static void R_SetSkyfog_f (convar *var)
|
||||
{
|
||||
// clear any skyfog setting from worldspawn
|
||||
skyfog = var->value;
|
||||
@@ -388,13 +397,13 @@ void Sky_Init (void)
|
||||
{
|
||||
int i;
|
||||
|
||||
Cvar_RegisterVariable (&r_fastsky);
|
||||
Cvar_RegisterVariable (&r_sky_quality);
|
||||
Cvar_RegisterVariable (&r_skyalpha);
|
||||
Cvar_RegisterVariable (&r_skyfog);
|
||||
Cvar_SetCallback (&r_skyfog, R_SetSkyfog_f);
|
||||
r_fastsky.inscribe();
|
||||
r_sky_quality.inscribe();
|
||||
r_skyalpha.inscribe();
|
||||
r_skyfog.inscribe();
|
||||
r_skyfog.set_callback(R_SetSkyfog_f);
|
||||
|
||||
Cmd_AddCommand ("sky",Sky_SkyCommand_f);
|
||||
command::add ("sky",Sky_SkyCommand_f);
|
||||
|
||||
skybox_name[0] = 0;
|
||||
for (i=0; i<6; i++)
|
||||
@@ -1020,7 +1029,7 @@ void Sky_DrawFace (int axis)
|
||||
VectorSubtract(verts[2],verts[3],up);
|
||||
VectorSubtract(verts[2],verts[1],right);
|
||||
|
||||
di = q_max((int)r_sky_quality.value, 1);
|
||||
di = std::max((int)r_sky_quality.value, 1);
|
||||
qi = 1.0 / di;
|
||||
dj = (axis < 4) ? di*2 : di; //subdivide vertically more than horizontally on skybox sides
|
||||
qj = 1.0 / dj;
|
||||
|
||||
+389
-467
File diff suppressed because it is too large
Load Diff
+514
-670
File diff suppressed because it is too large
Load Diff
+5
-5
@@ -22,11 +22,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#include "quakedef.hpp"
|
||||
|
||||
extern cvar_t r_drawflat;
|
||||
extern convar r_drawflat;
|
||||
|
||||
cvar_t r_oldwater = {"r_oldwater", "0", CVAR_ARCHIVE};
|
||||
cvar_t r_waterquality = {"r_waterquality", "8", CVAR_NONE};
|
||||
cvar_t r_waterwarp = {"r_waterwarp", "1", CVAR_NONE};
|
||||
convar r_oldwater{"r_oldwater", "0", {.archive = true}};
|
||||
convar r_waterquality{"r_waterquality", "8"};
|
||||
convar r_waterwarp{"r_waterwarp", "1"};
|
||||
|
||||
int gl_warpimagesize;
|
||||
float load_subdivide_size; //johnfitz -- remember what subdivide_size value was when this map was loaded
|
||||
@@ -46,7 +46,7 @@ static const float turbsin[] = {
|
||||
|
||||
static msurface_t *warpface;
|
||||
|
||||
cvar_t gl_subdivide_size = {"gl_subdivide_size", "128", CVAR_ARCHIVE};
|
||||
convar gl_subdivide_size{"gl_subdivide_size", "128", {.archive = true}};
|
||||
|
||||
static void BoundPoly (int numverts, float *verts, vec3_t mins, vec3_t maxs)
|
||||
{
|
||||
|
||||
+30
-30
@@ -125,38 +125,38 @@ extern refdef_t r_refdef;
|
||||
extern mleaf_t *r_viewleaf, *r_oldviewleaf;
|
||||
extern int d_lightstylevalue[256]; // 8.8 fraction of base light value
|
||||
|
||||
extern cvar_t r_norefresh;
|
||||
extern cvar_t r_drawentities;
|
||||
extern cvar_t r_drawworld;
|
||||
extern cvar_t r_drawviewmodel;
|
||||
extern cvar_t r_speeds;
|
||||
extern cvar_t r_pos;
|
||||
extern cvar_t r_waterwarp;
|
||||
extern cvar_t r_fullbright;
|
||||
extern cvar_t r_lightmap;
|
||||
extern cvar_t r_lightmapwide;
|
||||
extern cvar_t r_shadows;
|
||||
extern cvar_t r_wateralpha;
|
||||
extern cvar_t r_lavaalpha;
|
||||
extern cvar_t r_telealpha;
|
||||
extern cvar_t r_slimealpha;
|
||||
extern cvar_t r_litwater;
|
||||
extern cvar_t r_dynamic;
|
||||
extern cvar_t r_novis;
|
||||
extern cvar_t r_scale;
|
||||
extern convar r_norefresh;
|
||||
extern convar r_drawentities;
|
||||
extern convar r_drawworld;
|
||||
extern convar r_drawviewmodel;
|
||||
extern convar r_speeds;
|
||||
extern convar r_pos;
|
||||
extern convar r_waterwarp;
|
||||
extern convar r_fullbright;
|
||||
extern convar r_lightmap;
|
||||
extern convar r_lightmapwide;
|
||||
extern convar r_shadows;
|
||||
extern convar r_wateralpha;
|
||||
extern convar r_lavaalpha;
|
||||
extern convar r_telealpha;
|
||||
extern convar r_slimealpha;
|
||||
extern convar r_litwater;
|
||||
extern convar r_dynamic;
|
||||
extern convar r_novis;
|
||||
extern convar r_scale;
|
||||
|
||||
extern cvar_t gl_clear;
|
||||
extern cvar_t gl_cull;
|
||||
extern cvar_t gl_smoothmodels;
|
||||
extern cvar_t gl_affinemodels;
|
||||
extern cvar_t gl_polyblend;
|
||||
extern cvar_t gl_flashblend;
|
||||
extern cvar_t gl_nocolors;
|
||||
extern cvar_t gl_finish;
|
||||
extern convar gl_clear;
|
||||
extern convar gl_cull;
|
||||
extern convar gl_smoothmodels;
|
||||
extern convar gl_affinemodels;
|
||||
extern convar gl_polyblend;
|
||||
extern convar gl_flashblend;
|
||||
extern convar gl_nocolors;
|
||||
extern convar gl_finish;
|
||||
|
||||
extern cvar_t gl_playermip;
|
||||
extern convar gl_playermip;
|
||||
|
||||
extern cvar_t gl_subdivide_size;
|
||||
extern convar gl_subdivide_size;
|
||||
extern float load_subdivide_size; //johnfitz -- remember what subdivide_size value was when this map was loaded
|
||||
|
||||
extern int gl_stencilbits;
|
||||
@@ -281,7 +281,7 @@ extern int rs_brushpolys, rs_aliaspolys, rs_skypolys;
|
||||
extern int rs_dynamiclightmaps, rs_brushpasses, rs_aliaspasses, rs_skypasses;
|
||||
|
||||
//johnfitz -- track developer statistics that vary every frame
|
||||
extern cvar_t devstats;
|
||||
extern convar devstats;
|
||||
typedef struct {
|
||||
int packetsize;
|
||||
int edicts;
|
||||
|
||||
+60
-60
@@ -57,35 +57,35 @@ jmp_buf host_abortserver;
|
||||
|
||||
byte *host_colormap;
|
||||
|
||||
cvar_t host_framerate = {"host_framerate","0",CVAR_NONE}; // set for slow motion
|
||||
cvar_t host_speeds = {"host_speeds","0",CVAR_NONE}; // set for running times
|
||||
cvar_t host_maxfps = {"host_maxfps", "72", CVAR_ARCHIVE}; //johnfitz
|
||||
cvar_t host_timescale = {"host_timescale", "0", CVAR_NONE}; //johnfitz
|
||||
cvar_t max_edicts = {"max_edicts", "8192", CVAR_NONE}; //johnfitz //ericw -- changed from 2048 to 8192, removed CVAR_ARCHIVE
|
||||
convar host_framerate = {"host_framerate","0"}; // set for slow motion
|
||||
convar host_speeds = {"host_speeds","0"}; // set for running times
|
||||
convar host_maxfps = {"host_maxfps", "72", {.archive = true}}; //johnfitz
|
||||
convar host_timescale = {"host_timescale", "0"}; //johnfitz
|
||||
convar max_edicts = {"max_edicts", "8192"}; //johnfitz //ericw -- changed from 2048 to 8192, removed CVAR_ARCHIVE
|
||||
|
||||
cvar_t sys_ticrate = {"sys_ticrate","0.05",CVAR_NONE}; // dedicated server
|
||||
cvar_t serverprofile = {"serverprofile","0",CVAR_NONE};
|
||||
convar sys_ticrate = {"sys_ticrate","0.05"}; // dedicated server
|
||||
convar serverprofile = {"serverprofile","0"};
|
||||
|
||||
cvar_t fraglimit = {"fraglimit","0",CVAR_NOTIFY|CVAR_SERVERINFO};
|
||||
cvar_t timelimit = {"timelimit","0",CVAR_NOTIFY|CVAR_SERVERINFO};
|
||||
cvar_t teamplay = {"teamplay","0",CVAR_NOTIFY|CVAR_SERVERINFO};
|
||||
cvar_t samelevel = {"samelevel","0",CVAR_NONE};
|
||||
cvar_t noexit = {"noexit","0",CVAR_NOTIFY|CVAR_SERVERINFO};
|
||||
cvar_t skill = {"skill","1",CVAR_NONE}; // 0 - 3
|
||||
cvar_t deathmatch = {"deathmatch","0",CVAR_NONE}; // 0, 1, or 2
|
||||
cvar_t coop = {"coop","0",CVAR_NONE}; // 0 or 1
|
||||
convar fraglimit = {"fraglimit","0",{.notify = true, .server_info = true}};
|
||||
convar timelimit = {"timelimit","0", {.notify = true, .server_info = true}};
|
||||
convar teamplay = {"teamplay","0",{.notify = true, .server_info = true}};
|
||||
convar samelevel = {"samelevel","0"};
|
||||
convar noexit = {"noexit","0",{.notify = true, .server_info = true}};
|
||||
convar skill = {"skill","1"}; // 0 - 3
|
||||
convar deathmatch = {"deathmatch","0"}; // 0, 1, or 2
|
||||
convar coop = {"coop","0"}; // 0 or 1
|
||||
|
||||
cvar_t pausable = {"pausable","1",CVAR_NONE};
|
||||
convar pausable = {"pausable","1"};
|
||||
|
||||
cvar_t developer = {"developer","0",CVAR_NONE};
|
||||
convar developer = {"developer","0"};
|
||||
|
||||
cvar_t temp1 = {"temp1","0",CVAR_NONE};
|
||||
convar temp1 = {"temp1","0"};
|
||||
|
||||
cvar_t devstats = {"devstats","0",CVAR_NONE}; //johnfitz -- track developer statistics that vary every frame
|
||||
convar devstats = {"devstats","0"}; //johnfitz -- track developer statistics that vary every frame
|
||||
|
||||
cvar_t campaign = {"campaign","0",CVAR_NONE}; // for the 2021 rerelease
|
||||
cvar_t horde = {"horde","0",CVAR_NONE}; // for the 2021 rerelease
|
||||
cvar_t sv_cheats = {"sv_cheats","0",CVAR_NONE}; // for the 2021 rerelease
|
||||
convar campaign = {"campaign","0"}; // for the 2021 rerelease
|
||||
convar horde = {"horde","0"}; // for the 2021 rerelease
|
||||
convar sv_cheats = {"sv_cheats","0"}; // for the 2021 rerelease
|
||||
|
||||
devstats_t dev_stats, dev_peakstats;
|
||||
overflowtimes_t dev_overflows; //this stores the last time overflow messages were displayed, not the last time overflows occured
|
||||
@@ -95,7 +95,7 @@ overflowtimes_t dev_overflows; //this stores the last time overflow messages wer
|
||||
Max_Edicts_f -- johnfitz
|
||||
================
|
||||
*/
|
||||
static void Max_Edicts_f (cvar_t *var)
|
||||
static void Max_Edicts_f (convar *var)
|
||||
{
|
||||
//TODO: clamp it here?
|
||||
if (cls.state == ca_connected || sv.active)
|
||||
@@ -107,7 +107,7 @@ static void Max_Edicts_f (cvar_t *var)
|
||||
Max_Fps_f -- ericw
|
||||
================
|
||||
*/
|
||||
static void Max_Fps_f (cvar_t *var)
|
||||
static void Max_Fps_f (convar *var)
|
||||
{
|
||||
if (var->value > 72)
|
||||
Con_Warning ("host_maxfps above 72 breaks physics.\n");
|
||||
@@ -227,9 +227,9 @@ void Host_FindMaxClients (void)
|
||||
svs.clients = (struct client_s *) Hunk_AllocName (svs.maxclientslimit*sizeof(client_t), "clients");
|
||||
|
||||
if (svs.maxclients > 1)
|
||||
Cvar_SetQuick (&deathmatch, "1");
|
||||
deathmatch.set("1");
|
||||
else
|
||||
Cvar_SetQuick (&deathmatch, "0");
|
||||
deathmatch.set("0");
|
||||
}
|
||||
|
||||
void Host_Version_f (void)
|
||||
@@ -240,10 +240,10 @@ void Host_Version_f (void)
|
||||
}
|
||||
|
||||
/* cvar callback functions : */
|
||||
void Host_Callback_Notify (cvar_t *var)
|
||||
void Host_Callback_Notify (convar *var)
|
||||
{
|
||||
if (sv.active)
|
||||
SV_BroadcastPrintf ("\"%s\" changed to \"%s\"\n", var->name, var->string);
|
||||
SV_BroadcastPrintf ("\"%s\" changed to \"%s\"\n", var->name.c_str(), var->string);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -253,45 +253,45 @@ Host_InitLocal
|
||||
*/
|
||||
void Host_InitLocal (void)
|
||||
{
|
||||
Cmd_AddCommand ("version", Host_Version_f);
|
||||
command::add ("version", Host_Version_f);
|
||||
|
||||
Host_InitCommands ();
|
||||
|
||||
Cvar_RegisterVariable (&host_framerate);
|
||||
Cvar_RegisterVariable (&host_speeds);
|
||||
Cvar_RegisterVariable (&host_maxfps); //johnfitz
|
||||
Cvar_SetCallback (&host_maxfps, Max_Fps_f);
|
||||
Cvar_RegisterVariable (&host_timescale); //johnfitz
|
||||
host_framerate.inscribe();
|
||||
host_speeds.inscribe();
|
||||
host_maxfps.inscribe(); //johnfitz
|
||||
host_maxfps.set_callback(Max_Fps_f);
|
||||
host_timescale.inscribe(); //johnfitz
|
||||
|
||||
Cvar_RegisterVariable (&max_edicts); //johnfitz
|
||||
Cvar_SetCallback (&max_edicts, Max_Edicts_f);
|
||||
Cvar_RegisterVariable (&devstats); //johnfitz
|
||||
max_edicts.inscribe(); //johnfitz
|
||||
max_edicts.set_callback(Max_Edicts_f);
|
||||
devstats.inscribe(); //johnfitz
|
||||
|
||||
Cvar_RegisterVariable (&sys_ticrate);
|
||||
Cvar_RegisterVariable (&sys_throttle);
|
||||
Cvar_RegisterVariable (&serverprofile);
|
||||
sys_ticrate.inscribe();
|
||||
sys_throttle.inscribe();
|
||||
serverprofile.inscribe();
|
||||
|
||||
Cvar_RegisterVariable (&fraglimit);
|
||||
Cvar_RegisterVariable (&timelimit);
|
||||
Cvar_RegisterVariable (&teamplay);
|
||||
Cvar_SetCallback (&fraglimit, Host_Callback_Notify);
|
||||
Cvar_SetCallback (&timelimit, Host_Callback_Notify);
|
||||
Cvar_SetCallback (&teamplay, Host_Callback_Notify);
|
||||
Cvar_RegisterVariable (&samelevel);
|
||||
Cvar_RegisterVariable (&noexit);
|
||||
Cvar_SetCallback (&noexit, Host_Callback_Notify);
|
||||
Cvar_RegisterVariable (&skill);
|
||||
Cvar_RegisterVariable (&developer);
|
||||
Cvar_RegisterVariable (&coop);
|
||||
Cvar_RegisterVariable (&deathmatch);
|
||||
fraglimit.inscribe();
|
||||
timelimit.inscribe();
|
||||
teamplay.inscribe();
|
||||
fraglimit.set_callback(Host_Callback_Notify);
|
||||
timelimit.set_callback(Host_Callback_Notify);
|
||||
teamplay.set_callback(Host_Callback_Notify);
|
||||
samelevel.inscribe();
|
||||
noexit.inscribe();
|
||||
noexit.set_callback(Host_Callback_Notify);
|
||||
skill.inscribe();
|
||||
developer.inscribe();
|
||||
coop.inscribe();
|
||||
deathmatch.inscribe();
|
||||
|
||||
Cvar_RegisterVariable (&campaign);
|
||||
Cvar_RegisterVariable (&horde);
|
||||
Cvar_RegisterVariable (&sv_cheats);
|
||||
campaign.inscribe();
|
||||
horde.inscribe();
|
||||
sv_cheats.inscribe();
|
||||
|
||||
Cvar_RegisterVariable (&pausable);
|
||||
pausable.inscribe();
|
||||
|
||||
Cvar_RegisterVariable (&temp1);
|
||||
temp1.inscribe();
|
||||
|
||||
Host_FindMaxClients ();
|
||||
}
|
||||
@@ -661,7 +661,7 @@ void Host_ServerFrame (void)
|
||||
if (active > 600 && dev_peakstats.edicts <= 600)
|
||||
Con_DWarning ("%i edicts exceeds standard limit of 600 (max = %d).\n", active, sv.max_edicts);
|
||||
dev_stats.edicts = active;
|
||||
dev_peakstats.edicts = q_max(active, dev_peakstats.edicts);
|
||||
dev_peakstats.edicts = std::max(active, dev_peakstats.edicts);
|
||||
}
|
||||
//johnfitz
|
||||
|
||||
@@ -832,7 +832,7 @@ void Host_Init (void)
|
||||
|
||||
Memory_Init (host_parms->membase, host_parms->memsize);
|
||||
Cbuf_Init ();
|
||||
Cmd_Init ();
|
||||
command::init ();
|
||||
LOG_Init (host_parms);
|
||||
Cvar_Init (); //johnfitz
|
||||
COM_Init ();
|
||||
|
||||
+178
-172
@@ -21,12 +21,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
*/
|
||||
|
||||
#include <sstream>
|
||||
|
||||
#include "quakedef.hpp"
|
||||
#ifndef _WIN32
|
||||
#include <dirent.h>
|
||||
#endif
|
||||
|
||||
extern cvar_t pausable;
|
||||
extern convar pausable;
|
||||
|
||||
int current_skill;
|
||||
|
||||
@@ -425,11 +427,11 @@ static void Host_Status_f (void)
|
||||
int hours = 0;
|
||||
int j;
|
||||
|
||||
if (cmd_source == src_command)
|
||||
if (command::last_source == command::source::command)
|
||||
{
|
||||
if (!sv.active)
|
||||
{
|
||||
Cmd_ForwardToServer ();
|
||||
command::forward_to_server ();
|
||||
return;
|
||||
}
|
||||
print_fn = Con_Printf;
|
||||
@@ -437,7 +439,7 @@ static void Host_Status_f (void)
|
||||
else
|
||||
print_fn = SV_ClientPrintf;
|
||||
|
||||
print_fn ("host: %s\n", Cvar_VariableString ("hostname"));
|
||||
print_fn ("host: %s\n", convar::variable_string("hostname").value_or("").c_str());
|
||||
print_fn ("version: %4.2f\n", VERSION);
|
||||
if (tcpipAvailable)
|
||||
print_fn ("tcp/ip: %s\n", my_tcpip_address);
|
||||
@@ -474,9 +476,9 @@ Sets client to godmode
|
||||
*/
|
||||
static void Host_God_f (void)
|
||||
{
|
||||
if (cmd_source == src_command)
|
||||
if (command::last_source == command::source::command)
|
||||
{
|
||||
Cmd_ForwardToServer ();
|
||||
command::forward_to_server();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -484,7 +486,7 @@ static void Host_God_f (void)
|
||||
return;
|
||||
|
||||
//johnfitz -- allow user to explicitly set god mode to on or off
|
||||
switch (Cmd_Argc())
|
||||
switch (command::argc())
|
||||
{
|
||||
case 1:
|
||||
sv_player->v.flags = (int)sv_player->v.flags ^ FL_GODMODE;
|
||||
@@ -494,7 +496,7 @@ static void Host_God_f (void)
|
||||
SV_ClientPrintf ("godmode ON\n");
|
||||
break;
|
||||
case 2:
|
||||
if (Q_atof(Cmd_Argv(1)))
|
||||
if (Q_atof(command::argv(1)->c_str()))
|
||||
{
|
||||
sv_player->v.flags = (int)sv_player->v.flags | FL_GODMODE;
|
||||
SV_ClientPrintf ("godmode ON\n");
|
||||
@@ -513,9 +515,9 @@ static void Host_God_f (void)
|
||||
}
|
||||
|
||||
static void Host_Buddha_f (void) {
|
||||
if (cmd_source == src_command)
|
||||
if (command::last_source == command::source::command)
|
||||
{
|
||||
Cmd_ForwardToServer ();
|
||||
command::forward_to_server();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -536,9 +538,9 @@ Host_Notarget_f
|
||||
*/
|
||||
static void Host_Notarget_f (void)
|
||||
{
|
||||
if (cmd_source == src_command)
|
||||
if (command::last_source == command::source::command)
|
||||
{
|
||||
Cmd_ForwardToServer ();
|
||||
command::forward_to_server();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -546,7 +548,7 @@ static void Host_Notarget_f (void)
|
||||
return;
|
||||
|
||||
//johnfitz -- allow user to explicitly set notarget to on or off
|
||||
switch (Cmd_Argc())
|
||||
switch (command::argc())
|
||||
{
|
||||
case 1:
|
||||
sv_player->v.flags = (int)sv_player->v.flags ^ FL_NOTARGET;
|
||||
@@ -556,7 +558,7 @@ static void Host_Notarget_f (void)
|
||||
SV_ClientPrintf ("notarget ON\n");
|
||||
break;
|
||||
case 2:
|
||||
if (Q_atof(Cmd_Argv(1)))
|
||||
if (Q_atof(command::argv(1)->c_str()))
|
||||
{
|
||||
sv_player->v.flags = (int)sv_player->v.flags | FL_NOTARGET;
|
||||
SV_ClientPrintf ("notarget ON\n");
|
||||
@@ -583,9 +585,9 @@ Host_Noclip_f
|
||||
*/
|
||||
static void Host_Noclip_f (void)
|
||||
{
|
||||
if (cmd_source == src_command)
|
||||
if (command::last_source == command::source::command)
|
||||
{
|
||||
Cmd_ForwardToServer ();
|
||||
command::forward_to_server();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -593,7 +595,7 @@ static void Host_Noclip_f (void)
|
||||
return;
|
||||
|
||||
//johnfitz -- allow user to explicitly set noclip to on or off
|
||||
switch (Cmd_Argc())
|
||||
switch (command::argc())
|
||||
{
|
||||
case 1:
|
||||
if (sv_player->v.movetype != MOVETYPE_NOCLIP)
|
||||
@@ -610,7 +612,7 @@ static void Host_Noclip_f (void)
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (Q_atof(Cmd_Argv(1)))
|
||||
if (Q_atof(command::argv(1)->c_str()))
|
||||
{
|
||||
noclip_anglehack = true;
|
||||
sv_player->v.movetype = MOVETYPE_NOCLIP;
|
||||
@@ -639,16 +641,15 @@ adapted from fteqw, originally by Alex Shadowalker
|
||||
*/
|
||||
static void Host_SetPos_f(void)
|
||||
{
|
||||
if (cmd_source == src_command)
|
||||
if (command::last_source == command::source::command)
|
||||
{
|
||||
Cmd_ForwardToServer ();
|
||||
command::forward_to_server();
|
||||
return;
|
||||
}
|
||||
|
||||
if (pr_global_struct->deathmatch)
|
||||
return;
|
||||
|
||||
if (Cmd_Argc() != 7 && Cmd_Argc() != 4)
|
||||
if (command::argc() != 7 && command::argc() != 4)
|
||||
{
|
||||
SV_ClientPrintf("usage:\n");
|
||||
SV_ClientPrintf(" setpos <x> <y> <z>\n");
|
||||
@@ -676,15 +677,15 @@ static void Host_SetPos_f(void)
|
||||
sv_player->v.velocity[1] = 0;
|
||||
sv_player->v.velocity[2] = 0;
|
||||
|
||||
sv_player->v.origin[0] = atof(Cmd_Argv(1));
|
||||
sv_player->v.origin[1] = atof(Cmd_Argv(2));
|
||||
sv_player->v.origin[2] = atof(Cmd_Argv(3));
|
||||
sv_player->v.origin[0] = atof(command::argv(1)->c_str());
|
||||
sv_player->v.origin[1] = atof(command::argv(2)->c_str());
|
||||
sv_player->v.origin[2] = atof(command::argv(3)->c_str());
|
||||
|
||||
if (Cmd_Argc() == 7)
|
||||
if (command::argc() == 7)
|
||||
{
|
||||
sv_player->v.angles[0] = atof(Cmd_Argv(4));
|
||||
sv_player->v.angles[1] = atof(Cmd_Argv(5));
|
||||
sv_player->v.angles[2] = atof(Cmd_Argv(6));
|
||||
sv_player->v.angles[0] = atof(command::argv(4)->c_str());
|
||||
sv_player->v.angles[1] = atof(command::argv(5)->c_str());
|
||||
sv_player->v.angles[2] = atof(command::argv(6)->c_str());
|
||||
sv_player->v.fixangle = 1;
|
||||
}
|
||||
|
||||
@@ -700,9 +701,9 @@ Sets client to flymode
|
||||
*/
|
||||
static void Host_Fly_f (void)
|
||||
{
|
||||
if (cmd_source == src_command)
|
||||
if (command::last_source == command::source::command)
|
||||
{
|
||||
Cmd_ForwardToServer ();
|
||||
command::forward_to_server();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -710,7 +711,7 @@ static void Host_Fly_f (void)
|
||||
return;
|
||||
|
||||
//johnfitz -- allow user to explicitly set noclip to on or off
|
||||
switch (Cmd_Argc())
|
||||
switch (command::argc())
|
||||
{
|
||||
case 1:
|
||||
if (sv_player->v.movetype != MOVETYPE_FLY)
|
||||
@@ -725,7 +726,7 @@ static void Host_Fly_f (void)
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (Q_atof(Cmd_Argv(1)))
|
||||
if (Q_atof(command::argv(1)->c_str()))
|
||||
{
|
||||
sv_player->v.movetype = MOVETYPE_FLY;
|
||||
SV_ClientPrintf ("flymode ON\n");
|
||||
@@ -755,9 +756,9 @@ static void Host_Ping_f (void)
|
||||
float total;
|
||||
client_t *client;
|
||||
|
||||
if (cmd_source == src_command)
|
||||
if (command::last_source == command::source::command)
|
||||
{
|
||||
Cmd_ForwardToServer ();
|
||||
command::forward_to_server();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -796,7 +797,7 @@ static void Host_Map_f (void)
|
||||
int i;
|
||||
char name[MAX_QPATH], *p;
|
||||
|
||||
if (Cmd_Argc() < 2) //no map name given
|
||||
if (command::argc() < 2) //no map name given
|
||||
{
|
||||
if (cls.state == ca_dedicated)
|
||||
{
|
||||
@@ -816,8 +817,10 @@ static void Host_Map_f (void)
|
||||
return;
|
||||
}
|
||||
|
||||
if (cmd_source != src_command)
|
||||
if (command::last_source != command::source::command)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
cls.demonum = -1; // stop demo loop in case this fails
|
||||
|
||||
@@ -830,7 +833,7 @@ static void Host_Map_f (void)
|
||||
SCR_BeginLoadingPlaque ();
|
||||
|
||||
svs.serverflags = 0; // haven't completed an episode yet
|
||||
q_strlcpy (name, Cmd_Argv(1), sizeof(name));
|
||||
q_strlcpy (name, command::argv(1)->c_str(), sizeof(name));
|
||||
// remove (any) trailing ".bsp" from mapname -- S.A.
|
||||
p = strstr(name, ".bsp");
|
||||
if (p && p[4] == '\0')
|
||||
@@ -842,13 +845,13 @@ static void Host_Map_f (void)
|
||||
if (cls.state != ca_dedicated)
|
||||
{
|
||||
memset (cls.spawnparms, 0, MAX_MAPSTRING);
|
||||
for (i = 2; i < Cmd_Argc(); i++)
|
||||
for (i = 2; i < command::argc(); i++)
|
||||
{
|
||||
q_strlcat (cls.spawnparms, Cmd_Argv(i), MAX_MAPSTRING);
|
||||
q_strlcat (cls.spawnparms, command::argv(i)->c_str(), MAX_MAPSTRING);
|
||||
q_strlcat (cls.spawnparms, " ", MAX_MAPSTRING);
|
||||
}
|
||||
|
||||
Cmd_ExecuteString ("connect local", src_command);
|
||||
command::execute_string ("connect local", command::source::command);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -864,7 +867,7 @@ static void Host_Randmap_f (void)
|
||||
int i, randlevel, numlevels;
|
||||
filelist_item_t *level;
|
||||
|
||||
if (cmd_source != src_command)
|
||||
if (command::last_source != command::source::command)
|
||||
return;
|
||||
|
||||
for (level = extralevels, numlevels = 0; level; level = level->next)
|
||||
@@ -900,7 +903,7 @@ static void Host_Changelevel_f (void)
|
||||
{
|
||||
char level[MAX_QPATH];
|
||||
|
||||
if (Cmd_Argc() != 2)
|
||||
if (command::argc() != 2)
|
||||
{
|
||||
Con_Printf ("changelevel <levelname> : continue game on a new level\n");
|
||||
return;
|
||||
@@ -912,7 +915,7 @@ static void Host_Changelevel_f (void)
|
||||
}
|
||||
|
||||
//johnfitz -- check for client having map before anything else
|
||||
q_snprintf (level, sizeof(level), "maps/%s.bsp", Cmd_Argv(1));
|
||||
q_snprintf (level, sizeof(level), "maps/%s.bsp", command::argv(1)->c_str());
|
||||
if (!COM_FileExists(level, NULL))
|
||||
Host_Error ("cannot find map %s", level);
|
||||
//johnfitz
|
||||
@@ -921,7 +924,7 @@ static void Host_Changelevel_f (void)
|
||||
IN_Activate(); // -- S.A.
|
||||
key_dest = key_game; // remove console or menu
|
||||
SV_SaveSpawnparms ();
|
||||
q_strlcpy (level, Cmd_Argv(1), sizeof(level));
|
||||
q_strlcpy (level, command::argv(1)->c_str(), sizeof(level));
|
||||
SV_SpawnServer (level);
|
||||
// also issue an error if spawn failed -- O.S.
|
||||
if (!sv.active)
|
||||
@@ -942,7 +945,7 @@ static void Host_Restart_f (void)
|
||||
if (cls.demoplayback || !sv.active)
|
||||
return;
|
||||
|
||||
if (cmd_source != src_command)
|
||||
if (command::last_source != command::source::command)
|
||||
return;
|
||||
q_strlcpy (mapname, sv.name, sizeof(mapname)); // mapname gets cleared in spawnserver
|
||||
SV_SpawnServer (mapname);
|
||||
@@ -984,7 +987,7 @@ static void Host_Connect_f (void)
|
||||
CL_StopPlayback ();
|
||||
CL_Disconnect ();
|
||||
}
|
||||
q_strlcpy (name, Cmd_Argv(1), sizeof(name));
|
||||
q_strlcpy (name, command::argv(1).value_or("").c_str(), sizeof(name));
|
||||
CL_EstablishConnection (name);
|
||||
Host_Reconnect_f ();
|
||||
}
|
||||
@@ -1051,7 +1054,7 @@ static void Host_Savegame_f (void)
|
||||
int i;
|
||||
char comment[SAVEGAME_COMMENT_LENGTH+1];
|
||||
|
||||
if (cmd_source != src_command)
|
||||
if (command::last_source != command::source::command)
|
||||
return;
|
||||
|
||||
if (!sv.active)
|
||||
@@ -1072,13 +1075,13 @@ static void Host_Savegame_f (void)
|
||||
return;
|
||||
}
|
||||
|
||||
if (Cmd_Argc() != 2)
|
||||
if (command::argc() != 2)
|
||||
{
|
||||
Con_Printf ("save <savename> : save a game\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (strstr(Cmd_Argv(1), ".."))
|
||||
if (strstr(command::argv(1)->c_str(), ".."))
|
||||
{
|
||||
Con_Printf ("Relative pathnames are not allowed.\n");
|
||||
return;
|
||||
@@ -1093,7 +1096,7 @@ static void Host_Savegame_f (void)
|
||||
}
|
||||
}
|
||||
|
||||
q_snprintf (name, sizeof(name), "%s/%s", com_gamedir, Cmd_Argv(1));
|
||||
q_snprintf (name, sizeof(name), "%s/%s", com_gamedir, command::argv(1)->c_str());
|
||||
COM_AddExtension (name, ".sav", sizeof(name));
|
||||
|
||||
Con_Printf ("Saving game to %s...\n", name);
|
||||
@@ -1143,24 +1146,22 @@ static void Host_Loadgame_f (void)
|
||||
|
||||
char name[MAX_OSPATH];
|
||||
char mapname[MAX_QPATH];
|
||||
float time, tfloat;
|
||||
const char *data;
|
||||
int i;
|
||||
edict_t *ent;
|
||||
int entnum;
|
||||
int version;
|
||||
float spawn_parms[NUM_SPAWN_PARMS];
|
||||
|
||||
if (cmd_source != src_command)
|
||||
if (command::last_source != command::source::command)
|
||||
return;
|
||||
|
||||
if (Cmd_Argc() != 2)
|
||||
if (command::argc() != 2)
|
||||
{
|
||||
Con_Printf ("load <savename> : load a game\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (strstr(Cmd_Argv(1), ".."))
|
||||
if (strstr(command::argv(1)->c_str(), ".."))
|
||||
{
|
||||
Con_Printf ("Relative pathnames are not allowed.\n");
|
||||
return;
|
||||
@@ -1168,7 +1169,7 @@ static void Host_Loadgame_f (void)
|
||||
|
||||
cls.demonum = -1; // stop demo loop in case this fails
|
||||
|
||||
q_snprintf (name, sizeof(name), "%s/%s", com_gamedir, Cmd_Argv(1));
|
||||
q_snprintf (name, sizeof(name), "%s/%s", com_gamedir, command::argv(1)->c_str());
|
||||
COM_AddExtension (name, ".sav", sizeof(name));
|
||||
|
||||
// we can't call SCR_BeginLoadingPlaque, because too much stack space has
|
||||
@@ -1188,8 +1189,8 @@ static void Host_Loadgame_f (void)
|
||||
return;
|
||||
}
|
||||
|
||||
data = start;
|
||||
data = COM_ParseIntNewline (data, &version);
|
||||
std::istringstream ss{start};
|
||||
version = common::parse_int_newline(ss);
|
||||
if (version != SAVEGAME_VERSION)
|
||||
{
|
||||
free (start);
|
||||
@@ -1197,17 +1198,17 @@ static void Host_Loadgame_f (void)
|
||||
Host_Error ("Savegame is version %i, not %i", version, SAVEGAME_VERSION);
|
||||
return;
|
||||
}
|
||||
data = COM_ParseStringNewline (data);
|
||||
auto strr = common::parse_string_newline (ss);
|
||||
for (i = 0; i < NUM_SPAWN_PARMS; i++)
|
||||
data = COM_ParseFloatNewline (data, &spawn_parms[i]);
|
||||
spawn_parms[i] = common::parse_float_newline(ss);
|
||||
// this silliness is so we can load 1.06 save files, which have float skill values
|
||||
data = COM_ParseFloatNewline(data, &tfloat);
|
||||
const float tfloat = common::parse_float_newline(ss);
|
||||
current_skill = (int)(tfloat + 0.1);
|
||||
Cvar_SetValue ("skill", (float)current_skill);
|
||||
convar::set_value ("skill", (float)current_skill);
|
||||
|
||||
data = COM_ParseStringNewline (data);
|
||||
q_strlcpy (mapname, com_token, sizeof(mapname));
|
||||
data = COM_ParseFloatNewline (data, &time);
|
||||
strr = common::parse_string_newline(ss);
|
||||
q_strlcpy (mapname, strr.c_str(), sizeof(mapname));
|
||||
const float time = common::parse_float_newline(ss);
|
||||
|
||||
CL_Disconnect_f ();
|
||||
|
||||
@@ -1227,25 +1228,25 @@ static void Host_Loadgame_f (void)
|
||||
// load the light styles
|
||||
for (i = 0; i < MAX_LIGHTSTYLES; i++)
|
||||
{
|
||||
data = COM_ParseStringNewline (data);
|
||||
sv.lightstyles[i] = (const char *)Hunk_Strdup (com_token, "lightstyles");
|
||||
strr = common::parse_string_newline(ss);
|
||||
sv.lightstyles[i] = (const char *)Hunk_Strdup (strr.c_str(), "lightstyles");
|
||||
}
|
||||
|
||||
// load the edicts out of the savegame file
|
||||
entnum = -1; // -1 is the globals
|
||||
while (*data)
|
||||
while (!ss.eof())
|
||||
{
|
||||
data = COM_Parse (data);
|
||||
if (!com_token[0])
|
||||
auto token = common::parse_token(ss);
|
||||
if (!token.has_value())
|
||||
break; // end of file
|
||||
if (strcmp(com_token,"{"))
|
||||
if (token->front() != '{')
|
||||
{
|
||||
Host_Error ("First token isn't a brace");
|
||||
}
|
||||
|
||||
if (entnum == -1)
|
||||
{ // parse the global vars
|
||||
data = ED_ParseGlobals (data);
|
||||
ED_ParseGlobals (ss);
|
||||
}
|
||||
else
|
||||
{ // parse an edict
|
||||
@@ -1258,7 +1259,7 @@ static void Host_Loadgame_f (void)
|
||||
memset (ent, 0, pr_edict_size);
|
||||
ent->baseline.scale = ENTSCALE_DEFAULT;
|
||||
}
|
||||
data = ED_ParseEdict (data, ent);
|
||||
ED_ParseEdict (ss, ent);
|
||||
|
||||
// link it into the bsp tree
|
||||
if (!ent->free)
|
||||
@@ -1302,24 +1303,24 @@ static void Host_Name_f (void)
|
||||
{
|
||||
char newName[32];
|
||||
|
||||
if (Cmd_Argc () == 1)
|
||||
if (command::argc () == 1)
|
||||
{
|
||||
Con_Printf ("\"name\" is \"%s\"\n", cl_name.string);
|
||||
return;
|
||||
}
|
||||
if (Cmd_Argc () == 2)
|
||||
q_strlcpy(newName, Cmd_Argv(1), sizeof(newName));
|
||||
if (command::argc () == 2)
|
||||
q_strlcpy(newName, command::argv(1)->c_str(), sizeof(newName));
|
||||
else
|
||||
q_strlcpy(newName, Cmd_Args(), sizeof(newName));
|
||||
q_strlcpy(newName, command::args().c_str(), sizeof(newName));
|
||||
newName[15] = 0; // client_t structure actually says name[32].
|
||||
|
||||
if (cmd_source == src_command)
|
||||
if (command::last_source == command::source::command)
|
||||
{
|
||||
if (Q_strcmp(cl_name.string, newName) == 0)
|
||||
return;
|
||||
Cvar_Set ("_cl_name", newName);
|
||||
convar::set("_cl_name", newName);
|
||||
if (cls.state == ca_connected)
|
||||
Cmd_ForwardToServer ();
|
||||
command::forward_to_server ();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1342,28 +1343,28 @@ static void Host_Say(qboolean teamonly)
|
||||
int j;
|
||||
client_t *client;
|
||||
client_t *save;
|
||||
const char *p;
|
||||
char text[MAXCMDLINE], *p2;
|
||||
qboolean quoted;
|
||||
qboolean fromServer = false;
|
||||
|
||||
if (cmd_source == src_command)
|
||||
if (command::last_source == command::source::command)
|
||||
{
|
||||
if (cls.state != ca_dedicated)
|
||||
{
|
||||
Cmd_ForwardToServer ();
|
||||
command::forward_to_server ();
|
||||
return;
|
||||
}
|
||||
fromServer = true;
|
||||
teamonly = false;
|
||||
}
|
||||
|
||||
if (Cmd_Argc () < 2)
|
||||
if (command::argc () < 2)
|
||||
return;
|
||||
|
||||
save = host_client;
|
||||
|
||||
p = Cmd_Args();
|
||||
auto args = command::args();
|
||||
auto p = args.c_str();
|
||||
// remove quotes if present
|
||||
quoted = false;
|
||||
if (*p == '\"')
|
||||
@@ -1433,16 +1434,17 @@ static void Host_Tell_f(void)
|
||||
char text[MAXCMDLINE], *p2;
|
||||
qboolean quoted;
|
||||
|
||||
if (cmd_source == src_command)
|
||||
if (command::last_source == command::source::command)
|
||||
{
|
||||
Cmd_ForwardToServer ();
|
||||
command::forward_to_server();
|
||||
return;
|
||||
}
|
||||
|
||||
if (Cmd_Argc () < 3)
|
||||
if (command::argc () < 3)
|
||||
return;
|
||||
|
||||
p = Cmd_Args();
|
||||
auto args = command::args();
|
||||
p = args.c_str();
|
||||
// remove quotes if present
|
||||
quoted = false;
|
||||
if (*p == '\"')
|
||||
@@ -1479,7 +1481,7 @@ static void Host_Tell_f(void)
|
||||
{
|
||||
if (!client->active || !client->spawned)
|
||||
continue;
|
||||
if (q_strcasecmp(client->name, Cmd_Argv(1)))
|
||||
if (q_strcasecmp(client->name, command::argv(1)->c_str()))
|
||||
continue;
|
||||
host_client = client;
|
||||
SV_ClientPrintf("%s", text);
|
||||
@@ -1498,19 +1500,19 @@ static void Host_Color_f(void)
|
||||
int top, bottom;
|
||||
int playercolor;
|
||||
|
||||
if (Cmd_Argc() == 1)
|
||||
if (command::argc() == 1)
|
||||
{
|
||||
Con_Printf ("\"color\" is \"%i %i\"\n", ((int)cl_color.value) >> 4, ((int)cl_color.value) & 0x0f);
|
||||
Con_Printf ("color <0-13> [0-13]\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (Cmd_Argc() == 2)
|
||||
top = bottom = atoi(Cmd_Argv(1));
|
||||
if (command::argc() == 2)
|
||||
top = bottom = atoi(command::argv(1)->c_str());
|
||||
else
|
||||
{
|
||||
top = atoi(Cmd_Argv(1));
|
||||
bottom = atoi(Cmd_Argv(2));
|
||||
top = atoi(command::argv(1)->c_str());
|
||||
bottom = atoi(command::argv(2)->c_str());
|
||||
}
|
||||
|
||||
top &= 15;
|
||||
@@ -1522,11 +1524,11 @@ static void Host_Color_f(void)
|
||||
|
||||
playercolor = top*16 + bottom;
|
||||
|
||||
if (cmd_source == src_command)
|
||||
if (command::last_source == command::source::command)
|
||||
{
|
||||
Cvar_SetValue ("_cl_color", playercolor);
|
||||
convar::set_value ("_cl_color", playercolor);
|
||||
if (cls.state == ca_connected)
|
||||
Cmd_ForwardToServer ();
|
||||
command::forward_to_server ();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1546,9 +1548,9 @@ Host_Kill_f
|
||||
*/
|
||||
static void Host_Kill_f (void)
|
||||
{
|
||||
if (cmd_source == src_command)
|
||||
if (command::last_source == command::source::command)
|
||||
{
|
||||
Cmd_ForwardToServer ();
|
||||
command::forward_to_server();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1578,9 +1580,9 @@ static void Host_Pause_f (void)
|
||||
return;
|
||||
}
|
||||
|
||||
if (cmd_source == src_command)
|
||||
if (command::last_source == command::source::command)
|
||||
{
|
||||
Cmd_ForwardToServer ();
|
||||
command::forward_to_server();
|
||||
return;
|
||||
}
|
||||
if (!pausable.value)
|
||||
@@ -1613,7 +1615,7 @@ Host_PreSpawn_f
|
||||
*/
|
||||
static void Host_PreSpawn_f (void)
|
||||
{
|
||||
if (cmd_source == src_command)
|
||||
if (command::last_source == command::source::command)
|
||||
{
|
||||
Con_Printf ("prespawn is not valid from the console\n");
|
||||
return;
|
||||
@@ -1640,7 +1642,7 @@ static void Host_Spawn_f (void)
|
||||
client_t *client;
|
||||
edict_t *ent;
|
||||
|
||||
if (cmd_source == src_command)
|
||||
if (command::last_source == command::source::command)
|
||||
{
|
||||
Con_Printf ("spawn is not valid from the console\n");
|
||||
return;
|
||||
@@ -1755,7 +1757,7 @@ Host_Begin_f
|
||||
*/
|
||||
static void Host_Begin_f (void)
|
||||
{
|
||||
if (cmd_source == src_command)
|
||||
if (command::last_source == command::source::command)
|
||||
{
|
||||
Con_Printf ("begin is not valid from the console\n");
|
||||
return;
|
||||
@@ -1776,16 +1778,15 @@ Kicks a user off of the server
|
||||
static void Host_Kick_f (void)
|
||||
{
|
||||
const char *who;
|
||||
const char *message = NULL;
|
||||
client_t *save;
|
||||
int i;
|
||||
qboolean byNumber = false;
|
||||
|
||||
if (cmd_source == src_command)
|
||||
if (command::last_source == command::source::command)
|
||||
{
|
||||
if (!sv.active)
|
||||
{
|
||||
Cmd_ForwardToServer ();
|
||||
command::forward_to_server ();
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -1794,9 +1795,9 @@ static void Host_Kick_f (void)
|
||||
|
||||
save = host_client;
|
||||
|
||||
if (Cmd_Argc() > 2 && Q_strcmp(Cmd_Argv(1), "#") == 0)
|
||||
if (command::argc() > 2 && Q_strcmp(command::argv(1)->c_str(), "#") == 0)
|
||||
{
|
||||
i = Q_atof(Cmd_Argv(2)) - 1;
|
||||
i = Q_atof(command::argv(2)->c_str()) - 1;
|
||||
if (i < 0 || i >= svs.maxclients)
|
||||
return;
|
||||
if (!svs.clients[i].active)
|
||||
@@ -1810,14 +1811,14 @@ static void Host_Kick_f (void)
|
||||
{
|
||||
if (!host_client->active)
|
||||
continue;
|
||||
if (q_strcasecmp(host_client->name, Cmd_Argv(1)) == 0)
|
||||
if (q_strcasecmp(host_client->name, command::argv(1).value_or("").c_str()) == 0)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (i < svs.maxclients)
|
||||
{
|
||||
if (cmd_source == src_command)
|
||||
if (command::last_source == command::source::command)
|
||||
if (cls.state == ca_dedicated)
|
||||
who = "Console";
|
||||
else
|
||||
@@ -1829,21 +1830,25 @@ static void Host_Kick_f (void)
|
||||
if (host_client == save)
|
||||
return;
|
||||
|
||||
if (Cmd_Argc() > 2)
|
||||
std::string message{};
|
||||
if (command::argc() > 2)
|
||||
{
|
||||
message = COM_Parse(Cmd_Args());
|
||||
std::istringstream ss{command::args()};
|
||||
auto token = common::parse_token(ss);
|
||||
if (byNumber)
|
||||
{
|
||||
message++; // skip the #
|
||||
while (*message == ' ') // skip white space
|
||||
message++;
|
||||
message += strlen(Cmd_Argv(2)); // skip the number
|
||||
ss.get();
|
||||
while (ss.peek() == ' ') // skip white space
|
||||
ss.get();
|
||||
ss.seekg(command::argv(2)->length(), std::ios_base::seekdir::_S_cur); // skip the number
|
||||
}
|
||||
while (*message && *message == ' ')
|
||||
message++;
|
||||
while (!ss.eof() && ss.peek() == ' ')
|
||||
ss.get();
|
||||
|
||||
message += ss.str().substr(ss.tellg());
|
||||
}
|
||||
if (message)
|
||||
SV_ClientPrintf ("Kicked by %s: %s\n", who, message);
|
||||
if (!message.empty())
|
||||
SV_ClientPrintf ("Kicked by %s: %s\n", who, message.c_str());
|
||||
else
|
||||
SV_ClientPrintf ("Kicked by %s\n", who);
|
||||
SV_DropClient (false);
|
||||
@@ -1871,17 +1876,18 @@ static void Host_Give_f (void)
|
||||
int v;
|
||||
eval_t *val;
|
||||
|
||||
if (cmd_source == src_command)
|
||||
if (command::last_source == command::source::command)
|
||||
{
|
||||
Cmd_ForwardToServer ();
|
||||
command::forward_to_server();
|
||||
return;
|
||||
}
|
||||
|
||||
if (pr_global_struct->deathmatch)
|
||||
return;
|
||||
|
||||
t = Cmd_Argv(1);
|
||||
v = atoi (Cmd_Argv(2));
|
||||
auto arg1 = command::argv(1).value_or("");
|
||||
t = arg1.c_str();
|
||||
v = atoi (command::argv(2).value_or("").c_str());
|
||||
|
||||
switch (t[0])
|
||||
{
|
||||
@@ -2119,10 +2125,10 @@ static void Host_Viewmodel_f (void)
|
||||
if (!e)
|
||||
return;
|
||||
|
||||
m = Mod_ForName (Cmd_Argv(1), false);
|
||||
m = Mod_ForName (command::argv(1).value_or("").c_str(), false);
|
||||
if (!m)
|
||||
{
|
||||
Con_Printf ("Can't load %s\n", Cmd_Argv(1));
|
||||
Con_Printf ("Can't load %s\n", command::argv(1).value_or("").c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2146,7 +2152,7 @@ static void Host_Viewframe_f (void)
|
||||
return;
|
||||
m = cl.model_precache[(int)e->v.modelindex];
|
||||
|
||||
f = atoi(Cmd_Argv(1));
|
||||
f = atoi(command::argv(1).value_or("").c_str());
|
||||
if (f >= m->numframes)
|
||||
f = m->numframes - 1;
|
||||
|
||||
@@ -2231,7 +2237,7 @@ static void Host_Startdemos_f (void)
|
||||
if (cls.state == ca_dedicated)
|
||||
return;
|
||||
|
||||
c = Cmd_Argc() - 1;
|
||||
c = command::argc() - 1;
|
||||
if (c > MAX_DEMOS)
|
||||
{
|
||||
Con_Printf ("Max %i demos in demoloop\n", MAX_DEMOS);
|
||||
@@ -2240,7 +2246,7 @@ static void Host_Startdemos_f (void)
|
||||
Con_Printf ("%i demo(s) in loop\n", c);
|
||||
|
||||
for (i = 1; i < c + 1; i++)
|
||||
q_strlcpy (cls.demos[i-1], Cmd_Argv(i), sizeof(cls.demos[0]));
|
||||
q_strlcpy (cls.demos[i-1], command::argv(i)->c_str(), sizeof(cls.demos[0]));
|
||||
|
||||
if (!sv.active && cls.demonum != -1 && !cls.demoplayback)
|
||||
{
|
||||
@@ -2316,49 +2322,49 @@ Host_InitCommands
|
||||
*/
|
||||
void Host_InitCommands (void)
|
||||
{
|
||||
Cmd_AddCommand ("maps", Host_Maps_f); //johnfitz
|
||||
Cmd_AddCommand ("mods", Host_Mods_f); //johnfitz
|
||||
Cmd_AddCommand ("games", Host_Mods_f); // as an alias to "mods" -- S.A. / QuakeSpasm
|
||||
Cmd_AddCommand ("mapname", Host_Mapname_f); //johnfitz
|
||||
Cmd_AddCommand ("randmap", Host_Randmap_f); //ericw
|
||||
command::add ("maps", Host_Maps_f); //johnfitz
|
||||
command::add ("mods", Host_Mods_f); //johnfitz
|
||||
command::add ("games", Host_Mods_f); // as an alias to "mods" -- S.A. / QuakeSpasm
|
||||
command::add ("mapname", Host_Mapname_f); //johnfitz
|
||||
command::add ("randmap", Host_Randmap_f); //ericw
|
||||
|
||||
Cmd_AddCommand ("status", Host_Status_f);
|
||||
Cmd_AddCommand ("quit", Host_Quit_f);
|
||||
Cmd_AddCommand ("god", Host_God_f);
|
||||
Cmd_AddCommand("buddha", Host_Buddha_f);
|
||||
Cmd_AddCommand ("notarget", Host_Notarget_f);
|
||||
Cmd_AddCommand ("fly", Host_Fly_f);
|
||||
Cmd_AddCommand ("map", Host_Map_f);
|
||||
Cmd_AddCommand ("restart", Host_Restart_f);
|
||||
Cmd_AddCommand ("changelevel", Host_Changelevel_f);
|
||||
Cmd_AddCommand ("connect", Host_Connect_f);
|
||||
Cmd_AddCommand ("reconnect", Host_Reconnect_f);
|
||||
Cmd_AddCommand ("name", Host_Name_f);
|
||||
Cmd_AddCommand ("noclip", Host_Noclip_f);
|
||||
Cmd_AddCommand ("setpos", Host_SetPos_f); //QuakeSpasm
|
||||
command::add ("status", Host_Status_f);
|
||||
command::add ("quit", Host_Quit_f);
|
||||
command::add ("god", Host_God_f);
|
||||
command::add("buddha", Host_Buddha_f);
|
||||
command::add ("notarget", Host_Notarget_f);
|
||||
command::add ("fly", Host_Fly_f);
|
||||
command::add ("map", Host_Map_f);
|
||||
command::add ("restart", Host_Restart_f);
|
||||
command::add ("changelevel", Host_Changelevel_f);
|
||||
command::add ("connect", Host_Connect_f);
|
||||
command::add ("reconnect", Host_Reconnect_f);
|
||||
command::add ("name", Host_Name_f);
|
||||
command::add ("noclip", Host_Noclip_f);
|
||||
command::add ("setpos", Host_SetPos_f); //QuakeSpasm
|
||||
|
||||
Cmd_AddCommand ("say", Host_Say_f);
|
||||
Cmd_AddCommand ("say_team", Host_Say_Team_f);
|
||||
Cmd_AddCommand ("tell", Host_Tell_f);
|
||||
Cmd_AddCommand ("color", Host_Color_f);
|
||||
Cmd_AddCommand ("kill", Host_Kill_f);
|
||||
Cmd_AddCommand ("pause", Host_Pause_f);
|
||||
Cmd_AddCommand ("spawn", Host_Spawn_f);
|
||||
Cmd_AddCommand ("begin", Host_Begin_f);
|
||||
Cmd_AddCommand ("prespawn", Host_PreSpawn_f);
|
||||
Cmd_AddCommand ("kick", Host_Kick_f);
|
||||
Cmd_AddCommand ("ping", Host_Ping_f);
|
||||
Cmd_AddCommand ("load", Host_Loadgame_f);
|
||||
Cmd_AddCommand ("save", Host_Savegame_f);
|
||||
Cmd_AddCommand ("give", Host_Give_f);
|
||||
command::add ("say", Host_Say_f);
|
||||
command::add ("say_team", Host_Say_Team_f);
|
||||
command::add ("tell", Host_Tell_f);
|
||||
command::add ("color", Host_Color_f);
|
||||
command::add ("kill", Host_Kill_f);
|
||||
command::add ("pause", Host_Pause_f);
|
||||
command::add ("spawn", Host_Spawn_f);
|
||||
command::add ("begin", Host_Begin_f);
|
||||
command::add ("prespawn", Host_PreSpawn_f);
|
||||
command::add ("kick", Host_Kick_f);
|
||||
command::add ("ping", Host_Ping_f);
|
||||
command::add ("load", Host_Loadgame_f);
|
||||
command::add ("save", Host_Savegame_f);
|
||||
command::add ("give", Host_Give_f);
|
||||
|
||||
Cmd_AddCommand ("startdemos", Host_Startdemos_f);
|
||||
Cmd_AddCommand ("demos", Host_Demos_f);
|
||||
Cmd_AddCommand ("stopdemo", Host_Stopdemo_f);
|
||||
command::add ("startdemos", Host_Startdemos_f);
|
||||
command::add ("demos", Host_Demos_f);
|
||||
command::add ("stopdemo", Host_Stopdemo_f);
|
||||
|
||||
Cmd_AddCommand ("viewmodel", Host_Viewmodel_f);
|
||||
Cmd_AddCommand ("viewframe", Host_Viewframe_f);
|
||||
Cmd_AddCommand ("viewnext", Host_Viewnext_f);
|
||||
Cmd_AddCommand ("viewprev", Host_Viewprev_f);
|
||||
command::add ("viewmodel", Host_Viewmodel_f);
|
||||
command::add ("viewframe", Host_Viewframe_f);
|
||||
command::add ("viewnext", Host_Viewnext_f);
|
||||
command::add ("viewprev", Host_Viewprev_f);
|
||||
}
|
||||
|
||||
|
||||
+175
-260
@@ -35,7 +35,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
static qboolean windowhasfocus = true; //just in case sdl fails to tell us...
|
||||
static qboolean textmode;
|
||||
|
||||
static cvar_t in_debugkeys = {"in_debugkeys", "0", CVAR_NONE};
|
||||
static convar in_debugkeys{"in_debugkeys", "0"};
|
||||
|
||||
#ifdef __APPLE__
|
||||
/* Mouse acceleration needs to be disabled on OS X */
|
||||
@@ -50,18 +50,18 @@ static cvar_t in_debugkeys = {"in_debugkeys", "0", CVAR_NONE};
|
||||
#endif
|
||||
|
||||
// SDL2 Game Controller cvars
|
||||
cvar_t joy_deadzone_look = { "joy_deadzone_look", "0.175", CVAR_ARCHIVE };
|
||||
cvar_t joy_deadzone_move = { "joy_deadzone_move", "0.175", CVAR_ARCHIVE };
|
||||
cvar_t joy_outer_threshold_look = { "joy_outer_threshold_look", "0.02", CVAR_ARCHIVE };
|
||||
cvar_t joy_outer_threshold_move = { "joy_outer_threshold_move", "0.02", CVAR_ARCHIVE };
|
||||
cvar_t joy_deadzone_trigger = { "joy_deadzone_trigger", "0.2", CVAR_ARCHIVE };
|
||||
cvar_t joy_sensitivity_yaw = { "joy_sensitivity_yaw", "240", CVAR_ARCHIVE };
|
||||
cvar_t joy_sensitivity_pitch = { "joy_sensitivity_pitch", "130", CVAR_ARCHIVE };
|
||||
cvar_t joy_invert = { "joy_invert", "0", CVAR_ARCHIVE };
|
||||
cvar_t joy_exponent = { "joy_exponent", "2", CVAR_ARCHIVE };
|
||||
cvar_t joy_exponent_move = { "joy_exponent_move", "2", CVAR_ARCHIVE };
|
||||
cvar_t joy_swapmovelook = { "joy_swapmovelook", "0", CVAR_ARCHIVE };
|
||||
cvar_t joy_enable = { "joy_enable", "1", CVAR_ARCHIVE };
|
||||
convar joy_deadzone_look{"joy_deadzone_look", "0.175", {.archive = true}};
|
||||
convar joy_deadzone_move{"joy_deadzone_move", "0.175", {.archive = true}};
|
||||
convar joy_outer_threshold_look{"joy_outer_threshold_look", "0.02", {.archive = true}};
|
||||
convar joy_outer_threshold_move{"joy_outer_threshold_move", "0.02", {.archive = true}};
|
||||
convar joy_deadzone_trigger{"joy_deadzone_trigger", "0.2", {.archive = true}};
|
||||
convar joy_sensitivity_yaw{"joy_sensitivity_yaw", "240", {.archive = true}};
|
||||
convar joy_sensitivity_pitch{"joy_sensitivity_pitch", "130", {.archive = true}};
|
||||
convar joy_invert{"joy_invert", "0", {.archive = true}};
|
||||
convar joy_exponent{"joy_exponent", "2", {.archive = true}};
|
||||
convar joy_exponent_move{"joy_exponent_move", "2", {.archive = true}};
|
||||
convar joy_swapmovelook{"joy_swapmovelook", "0", {.archive = true}};
|
||||
convar joy_enable{"joy_enable", "1", {.archive = true}};
|
||||
|
||||
#if defined(USE_SDL2)
|
||||
static SDL_JoystickID joy_active_instaceid = -1;
|
||||
@@ -86,10 +86,8 @@ static int buttonremap[] =
|
||||
/* total accumulated mouse movement since last frame */
|
||||
static int total_dx, total_dy = 0;
|
||||
|
||||
static int SDLCALL IN_FilterMouseEvents (const SDL_Event *event)
|
||||
{
|
||||
switch (event->type)
|
||||
{
|
||||
static int SDLCALL IN_FilterMouseEvents(const SDL_Event *event) {
|
||||
switch (event->type) {
|
||||
case SDL_MOUSEMOTION:
|
||||
// case SDL_MOUSEBUTTONDOWN:
|
||||
// case SDL_MOUSEBUTTONUP:
|
||||
@@ -100,14 +98,12 @@ static int SDLCALL IN_FilterMouseEvents (const SDL_Event *event)
|
||||
}
|
||||
|
||||
#if defined(USE_SDL2)
|
||||
static int SDLCALL IN_SDL2_FilterMouseEvents (void *userdata, SDL_Event *event)
|
||||
{
|
||||
return IN_FilterMouseEvents (event);
|
||||
static int SDLCALL IN_SDL2_FilterMouseEvents(void *userdata, SDL_Event *event) {
|
||||
return IN_FilterMouseEvents(event);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void IN_BeginIgnoringMouseEvents(void)
|
||||
{
|
||||
static void IN_BeginIgnoringMouseEvents(void) {
|
||||
#if defined(USE_SDL2)
|
||||
SDL_EventFilter currentFilter = NULL;
|
||||
void *currentUserdata = NULL;
|
||||
@@ -121,8 +117,7 @@ static void IN_BeginIgnoringMouseEvents(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
static void IN_EndIgnoringMouseEvents(void)
|
||||
{
|
||||
static void IN_EndIgnoringMouseEvents(void) {
|
||||
#if defined(USE_SDL2)
|
||||
SDL_EventFilter currentFilter;
|
||||
void *currentUserdata;
|
||||
@@ -135,11 +130,10 @@ static void IN_EndIgnoringMouseEvents(void)
|
||||
}
|
||||
|
||||
#ifdef MACOS_X_ACCELERATION_HACK
|
||||
static cvar_t in_disablemacosxmouseaccel = {"in_disablemacosxmouseaccel", "1", CVAR_ARCHIVE};
|
||||
static convar in_disablemacosxmouseaccel = {"in_disablemacosxmouseaccel", "1", CVAR_ARCHIVE};
|
||||
static double originalMouseSpeed = -1.0;
|
||||
|
||||
static io_connect_t IN_GetIOHandle(void)
|
||||
{
|
||||
static io_connect_t IN_GetIOHandle(void) {
|
||||
io_connect_t iohandle = MACH_PORT_NULL;
|
||||
io_service_t iohidsystem = MACH_PORT_NULL;
|
||||
mach_port_t masterport;
|
||||
@@ -159,44 +153,34 @@ static io_connect_t IN_GetIOHandle(void)
|
||||
return iohandle;
|
||||
}
|
||||
|
||||
static void IN_DisableOSXMouseAccel (void)
|
||||
{
|
||||
static void IN_DisableOSXMouseAccel(void) {
|
||||
io_connect_t mouseDev = IN_GetIOHandle();
|
||||
if (mouseDev != 0)
|
||||
{
|
||||
if (IOHIDGetAccelerationWithKey(mouseDev, CFSTR(kIOHIDMouseAccelerationType), &originalMouseSpeed) == kIOReturnSuccess)
|
||||
{
|
||||
if (IOHIDSetAccelerationWithKey(mouseDev, CFSTR(kIOHIDMouseAccelerationType), -1.0) != kIOReturnSuccess)
|
||||
{
|
||||
Cvar_Set("in_disablemacosxmouseaccel", "0");
|
||||
if (mouseDev != 0) {
|
||||
if (IOHIDGetAccelerationWithKey(mouseDev, CFSTR(kIOHIDMouseAccelerationType), &originalMouseSpeed) ==
|
||||
kIOReturnSuccess) {
|
||||
if (IOHIDSetAccelerationWithKey(mouseDev, CFSTR(kIOHIDMouseAccelerationType), -1.0) != kIOReturnSuccess) {
|
||||
convar::set("in_disablemacosxmouseaccel", "0");
|
||||
Con_Printf("WARNING: Could not disable mouse acceleration (failed at IOHIDSetAccelerationWithKey).\n");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Cvar_Set("in_disablemacosxmouseaccel", "0");
|
||||
} else {
|
||||
convar::set("in_disablemacosxmouseaccel", "0");
|
||||
Con_Printf("WARNING: Could not disable mouse acceleration (failed at IOHIDGetAccelerationWithKey).\n");
|
||||
}
|
||||
IOServiceClose(mouseDev);
|
||||
}
|
||||
else
|
||||
{
|
||||
Cvar_Set("in_disablemacosxmouseaccel", "0");
|
||||
} else {
|
||||
convar::set("in_disablemacosxmouseaccel", "0");
|
||||
Con_Printf("WARNING: Could not disable mouse acceleration (failed at IO_GetIOHandle).\n");
|
||||
}
|
||||
}
|
||||
|
||||
static void IN_ReenableOSXMouseAccel (void)
|
||||
{
|
||||
static void IN_ReenableOSXMouseAccel(void) {
|
||||
io_connect_t mouseDev = IN_GetIOHandle();
|
||||
if (mouseDev != 0)
|
||||
{
|
||||
if (IOHIDSetAccelerationWithKey(mouseDev, CFSTR(kIOHIDMouseAccelerationType), originalMouseSpeed) != kIOReturnSuccess)
|
||||
if (mouseDev != 0) {
|
||||
if (IOHIDSetAccelerationWithKey(mouseDev, CFSTR(kIOHIDMouseAccelerationType), originalMouseSpeed) !=
|
||||
kIOReturnSuccess)
|
||||
Con_Printf("WARNING: Could not re-enable mouse acceleration (failed at IOHIDSetAccelerationWithKey).\n");
|
||||
IOServiceClose(mouseDev);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
Con_Printf("WARNING: Could not re-enable mouse acceleration (failed at IO_GetIOHandle).\n");
|
||||
}
|
||||
originalMouseSpeed = -1;
|
||||
@@ -204,8 +188,7 @@ static void IN_ReenableOSXMouseAccel (void)
|
||||
#endif /* MACOS_X_ACCELERATION_HACK */
|
||||
|
||||
|
||||
void IN_Activate (void)
|
||||
{
|
||||
void IN_Activate(void) {
|
||||
if (no_mouse)
|
||||
return;
|
||||
|
||||
@@ -220,25 +203,22 @@ void IN_Activate (void)
|
||||
{
|
||||
// Work around https://github.com/sezero/quakespasm/issues/48
|
||||
int width, height;
|
||||
SDL_GetWindowSize((SDL_Window*) VID_GetWindow(), &width, &height);
|
||||
SDL_WarpMouseInWindow((SDL_Window*) VID_GetWindow(), width / 2, height / 2);
|
||||
SDL_GetWindowSize((SDL_Window *) VID_GetWindow(), &width, &height);
|
||||
SDL_WarpMouseInWindow((SDL_Window *) VID_GetWindow(), width / 2, height / 2);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (SDL_SetRelativeMouseMode(SDL_TRUE) != 0)
|
||||
{
|
||||
if (SDL_SetRelativeMouseMode(SDL_TRUE) != 0) {
|
||||
Con_Printf("WARNING: SDL_SetRelativeMouseMode(SDL_TRUE) failed.\n");
|
||||
}
|
||||
#else
|
||||
if (SDL_WM_GrabInput(SDL_GRAB_QUERY) != SDL_GRAB_ON)
|
||||
{
|
||||
if (SDL_WM_GrabInput(SDL_GRAB_QUERY) != SDL_GRAB_ON) {
|
||||
SDL_WM_GrabInput(SDL_GRAB_ON);
|
||||
if (SDL_WM_GrabInput(SDL_GRAB_QUERY) != SDL_GRAB_ON)
|
||||
Con_Printf("WARNING: SDL_WM_GrabInput(SDL_GRAB_ON) failed.\n");
|
||||
}
|
||||
|
||||
if (SDL_ShowCursor(SDL_QUERY) != SDL_DISABLE)
|
||||
{
|
||||
if (SDL_ShowCursor(SDL_QUERY) != SDL_DISABLE) {
|
||||
SDL_ShowCursor(SDL_DISABLE);
|
||||
if (SDL_ShowCursor(SDL_QUERY) != SDL_DISABLE)
|
||||
Con_Printf("WARNING: SDL_ShowCursor(SDL_DISABLE) failed.\n");
|
||||
@@ -251,8 +231,7 @@ void IN_Activate (void)
|
||||
total_dy = 0;
|
||||
}
|
||||
|
||||
void IN_Deactivate (qboolean free_cursor)
|
||||
{
|
||||
void IN_Deactivate(qboolean free_cursor) {
|
||||
if (no_mouse)
|
||||
return;
|
||||
|
||||
@@ -261,20 +240,17 @@ void IN_Deactivate (qboolean free_cursor)
|
||||
IN_ReenableOSXMouseAccel();
|
||||
#endif
|
||||
|
||||
if (free_cursor)
|
||||
{
|
||||
if (free_cursor) {
|
||||
#if defined(USE_SDL2)
|
||||
SDL_SetRelativeMouseMode(SDL_FALSE);
|
||||
#else
|
||||
if (SDL_WM_GrabInput(SDL_GRAB_QUERY) != SDL_GRAB_OFF)
|
||||
{
|
||||
if (SDL_WM_GrabInput(SDL_GRAB_QUERY) != SDL_GRAB_OFF) {
|
||||
SDL_WM_GrabInput(SDL_GRAB_OFF);
|
||||
if (SDL_WM_GrabInput(SDL_GRAB_QUERY) != SDL_GRAB_OFF)
|
||||
Con_Printf("WARNING: SDL_WM_GrabInput(SDL_GRAB_OFF) failed.\n");
|
||||
}
|
||||
|
||||
if (SDL_ShowCursor(SDL_QUERY) != SDL_ENABLE)
|
||||
{
|
||||
if (SDL_ShowCursor(SDL_QUERY) != SDL_ENABLE) {
|
||||
SDL_ShowCursor(SDL_ENABLE);
|
||||
if (SDL_ShowCursor(SDL_QUERY) != SDL_ENABLE)
|
||||
Con_Printf("WARNING: SDL_ShowCursor(SDL_ENABLE) failed.\n");
|
||||
@@ -286,8 +262,7 @@ void IN_Deactivate (qboolean free_cursor)
|
||||
IN_BeginIgnoringMouseEvents();
|
||||
}
|
||||
|
||||
void IN_StartupJoystick (void)
|
||||
{
|
||||
void IN_StartupJoystick(void) {
|
||||
#if defined(USE_SDL2)
|
||||
int i;
|
||||
int nummappings;
|
||||
@@ -297,68 +272,57 @@ void IN_StartupJoystick (void)
|
||||
if (COM_CheckParm("-nojoy"))
|
||||
return;
|
||||
|
||||
if (SDL_InitSubSystem(SDL_INIT_GAMECONTROLLER) == -1 )
|
||||
{
|
||||
if (SDL_InitSubSystem(SDL_INIT_GAMECONTROLLER) == -1) {
|
||||
Con_Warning("could not initialize SDL Game Controller\n");
|
||||
return;
|
||||
}
|
||||
|
||||
// Load additional SDL2 controller definitions from gamecontrollerdb.txt
|
||||
q_snprintf (controllerdb, sizeof(controllerdb), "%s/gamecontrollerdb.txt", com_basedir);
|
||||
q_snprintf(controllerdb, sizeof(controllerdb), "%s/gamecontrollerdb.txt", com_basedir);
|
||||
nummappings = SDL_GameControllerAddMappingsFromFile(controllerdb);
|
||||
if (nummappings > 0)
|
||||
Con_Printf("%d mappings loaded from gamecontrollerdb.txt\n", nummappings);
|
||||
|
||||
// Also try host_parms->userdir
|
||||
if (host_parms->userdir != host_parms->basedir)
|
||||
{
|
||||
q_snprintf (controllerdb, sizeof(controllerdb), "%s/gamecontrollerdb.txt", host_parms->userdir);
|
||||
if (host_parms->userdir != host_parms->basedir) {
|
||||
q_snprintf(controllerdb, sizeof(controllerdb), "%s/gamecontrollerdb.txt", host_parms->userdir);
|
||||
nummappings = SDL_GameControllerAddMappingsFromFile(controllerdb);
|
||||
if (nummappings > 0)
|
||||
Con_Printf("%d mappings loaded from gamecontrollerdb.txt\n", nummappings);
|
||||
}
|
||||
|
||||
for (i = 0; i < SDL_NumJoysticks(); i++)
|
||||
{
|
||||
for (i = 0; i < SDL_NumJoysticks(); i++) {
|
||||
const char *joyname = SDL_JoystickNameForIndex(i);
|
||||
if ( SDL_IsGameController(i) )
|
||||
{
|
||||
if (SDL_IsGameController(i)) {
|
||||
const char *controllername = SDL_GameControllerNameForIndex(i);
|
||||
gamecontroller = SDL_GameControllerOpen(i);
|
||||
if (gamecontroller)
|
||||
{
|
||||
if (gamecontroller) {
|
||||
Con_Printf("detected controller: %s\n", controllername != NULL ? controllername : "NULL");
|
||||
|
||||
joy_active_instaceid = SDL_JoystickInstanceID(SDL_GameControllerGetJoystick(gamecontroller));
|
||||
joy_active_controller = gamecontroller;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
Con_Warning("failed to open controller: %s\n", controllername != NULL ? controllername : "NULL");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Con_Warning("joystick missing controller mappings: %s\n", joyname != NULL ? joyname : "NULL" );
|
||||
} else {
|
||||
Con_Warning("joystick missing controller mappings: %s\n", joyname != NULL ? joyname : "NULL");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void IN_ShutdownJoystick (void)
|
||||
{
|
||||
void IN_ShutdownJoystick(void) {
|
||||
#if defined(USE_SDL2)
|
||||
SDL_QuitSubSystem(SDL_INIT_GAMECONTROLLER);
|
||||
#endif
|
||||
}
|
||||
|
||||
void IN_Init (void)
|
||||
{
|
||||
void IN_Init(void) {
|
||||
textmode = Key_TextEntry();
|
||||
|
||||
#if !defined(USE_SDL2)
|
||||
SDL_EnableUNICODE (textmode);
|
||||
SDL_EnableUNICODE(textmode);
|
||||
if (SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL) == -1)
|
||||
Con_Printf("Warning: SDL_EnableKeyRepeat() failed.\n");
|
||||
#else
|
||||
@@ -367,46 +331,43 @@ void IN_Init (void)
|
||||
else
|
||||
SDL_StopTextInput();
|
||||
#endif
|
||||
if (safemode || COM_CheckParm("-nomouse"))
|
||||
{
|
||||
if (safemode || COM_CheckParm("-nomouse")) {
|
||||
no_mouse = true;
|
||||
/* discard all mouse events when input is deactivated */
|
||||
IN_BeginIgnoringMouseEvents();
|
||||
}
|
||||
|
||||
#ifdef MACOS_X_ACCELERATION_HACK
|
||||
Cvar_RegisterVariable(&in_disablemacosxmouseaccel);
|
||||
in_disablemacosxmouseaccel.inscribe();
|
||||
#endif
|
||||
Cvar_RegisterVariable(&in_debugkeys);
|
||||
Cvar_RegisterVariable(&joy_sensitivity_yaw);
|
||||
Cvar_RegisterVariable(&joy_sensitivity_pitch);
|
||||
Cvar_RegisterVariable(&joy_deadzone_look);
|
||||
Cvar_RegisterVariable(&joy_deadzone_move);
|
||||
Cvar_RegisterVariable(&joy_outer_threshold_look);
|
||||
Cvar_RegisterVariable(&joy_outer_threshold_move);
|
||||
Cvar_RegisterVariable(&joy_deadzone_trigger);
|
||||
Cvar_RegisterVariable(&joy_invert);
|
||||
Cvar_RegisterVariable(&joy_exponent);
|
||||
Cvar_RegisterVariable(&joy_exponent_move);
|
||||
Cvar_RegisterVariable(&joy_swapmovelook);
|
||||
Cvar_RegisterVariable(&joy_enable);
|
||||
in_debugkeys.inscribe();
|
||||
joy_sensitivity_yaw.inscribe();
|
||||
joy_sensitivity_pitch.inscribe();
|
||||
joy_deadzone_look.inscribe();
|
||||
joy_deadzone_move.inscribe();
|
||||
joy_outer_threshold_look.inscribe();
|
||||
joy_outer_threshold_move.inscribe();
|
||||
joy_deadzone_trigger.inscribe();
|
||||
joy_invert.inscribe();
|
||||
joy_exponent.inscribe();
|
||||
joy_exponent_move.inscribe();
|
||||
joy_swapmovelook.inscribe();
|
||||
joy_enable.inscribe();
|
||||
|
||||
IN_Activate();
|
||||
IN_StartupJoystick();
|
||||
}
|
||||
|
||||
void IN_Shutdown (void)
|
||||
{
|
||||
void IN_Shutdown(void) {
|
||||
IN_Deactivate(true);
|
||||
IN_ShutdownJoystick();
|
||||
}
|
||||
|
||||
extern cvar_t cl_maxpitch; /* johnfitz -- variable pitch clamping */
|
||||
extern cvar_t cl_minpitch; /* johnfitz -- variable pitch clamping */
|
||||
extern convar cl_maxpitch; /* johnfitz -- variable pitch clamping */
|
||||
extern convar cl_minpitch; /* johnfitz -- variable pitch clamping */
|
||||
|
||||
|
||||
void IN_MouseMotion(int dx, int dy)
|
||||
{
|
||||
void IN_MouseMotion(int dx, int dy) {
|
||||
if (!windowhasfocus)
|
||||
dx = dy = 0; //don't change view angles etc while unfocused.
|
||||
total_dx += dx;
|
||||
@@ -414,19 +375,16 @@ void IN_MouseMotion(int dx, int dy)
|
||||
}
|
||||
|
||||
#if defined(USE_SDL2)
|
||||
typedef struct joyaxis_s
|
||||
{
|
||||
typedef struct joyaxis_s {
|
||||
float x;
|
||||
float y;
|
||||
} joyaxis_t;
|
||||
|
||||
typedef struct joy_buttonstate_s
|
||||
{
|
||||
typedef struct joy_buttonstate_s {
|
||||
qboolean buttondown[SDL_CONTROLLER_BUTTON_MAX];
|
||||
} joybuttonstate_t;
|
||||
|
||||
typedef struct axisstate_s
|
||||
{
|
||||
typedef struct axisstate_s {
|
||||
float axisvalue[SDL_CONTROLLER_AXIS_MAX]; // normalized to +-1
|
||||
} joyaxisstate_t;
|
||||
|
||||
@@ -448,8 +406,7 @@ IN_AxisMagnitude
|
||||
Returns the vector length of the given joystick axis
|
||||
================
|
||||
*/
|
||||
static vec_t IN_AxisMagnitude(joyaxis_t axis)
|
||||
{
|
||||
static vec_t IN_AxisMagnitude(joyaxis_t axis) {
|
||||
vec_t magnitude = sqrtf((axis.x * axis.x) + (axis.y * axis.y));
|
||||
return magnitude;
|
||||
}
|
||||
@@ -462,8 +419,7 @@ assumes axis values are in [-1, 1] and the vector magnitude has been clamped at
|
||||
Raises the axis values to the given exponent, keeping signs.
|
||||
================
|
||||
*/
|
||||
static joyaxis_t IN_ApplyEasing(joyaxis_t axis, float exponent)
|
||||
{
|
||||
static joyaxis_t IN_ApplyEasing(joyaxis_t axis, float exponent) {
|
||||
joyaxis_t result = {0};
|
||||
vec_t eased_magnitude;
|
||||
vec_t magnitude = IN_AxisMagnitude(axis);
|
||||
@@ -493,14 +449,13 @@ from https://github.com/jeremiah-sypult/Quakespasm-Rift
|
||||
and adapted from http://www.third-helix.com/2013/04/12/doing-thumbstick-dead-zones-right.html
|
||||
================
|
||||
*/
|
||||
static joyaxis_t IN_ApplyDeadzone(joyaxis_t axis, float deadzone, float outer_threshold)
|
||||
{
|
||||
static joyaxis_t IN_ApplyDeadzone(joyaxis_t axis, float deadzone, float outer_threshold) {
|
||||
joyaxis_t result = {0};
|
||||
vec_t magnitude = IN_AxisMagnitude(axis);
|
||||
|
||||
if ( magnitude > deadzone ) {
|
||||
if (magnitude > deadzone) {
|
||||
// rescale the magnitude so deadzone becomes 0, and 1-outer_threshold becomes 1
|
||||
const vec_t new_magnitude = q_min(1.0, (magnitude - deadzone) / (1.0 - deadzone - outer_threshold));
|
||||
const vec_t new_magnitude = std::min(1.0, (magnitude - deadzone) / (1.0 - deadzone - outer_threshold));
|
||||
const vec_t scale = new_magnitude / magnitude;
|
||||
result.x = axis.x * scale;
|
||||
result.y = axis.y * scale;
|
||||
@@ -514,10 +469,8 @@ static joyaxis_t IN_ApplyDeadzone(joyaxis_t axis, float deadzone, float outer_th
|
||||
IN_KeyForControllerButton
|
||||
================
|
||||
*/
|
||||
static int IN_KeyForControllerButton(SDL_GameControllerButton button)
|
||||
{
|
||||
switch (button)
|
||||
{
|
||||
static int IN_KeyForControllerButton(SDL_GameControllerButton button) {
|
||||
switch (button) {
|
||||
case SDL_CONTROLLER_BUTTON_A: return K_ABUTTON;
|
||||
case SDL_CONTROLLER_BUTTON_B: return K_BBUTTON;
|
||||
case SDL_CONTROLLER_BUTTON_X: return K_XBUTTON;
|
||||
@@ -546,31 +499,22 @@ and generates key repeats if the button is held down.
|
||||
Adapted from DarkPlaces by lordhavoc
|
||||
================
|
||||
*/
|
||||
static void IN_JoyKeyEvent(qboolean wasdown, qboolean isdown, int key, double *timer)
|
||||
{
|
||||
static void IN_JoyKeyEvent(qboolean wasdown, qboolean isdown, int key, double *timer) {
|
||||
// we can't use `realtime` for key repeats because it is not monotomic
|
||||
const double currenttime = Sys_DoubleTime();
|
||||
|
||||
if (wasdown)
|
||||
{
|
||||
if (isdown)
|
||||
{
|
||||
if (currenttime >= *timer)
|
||||
{
|
||||
if (wasdown) {
|
||||
if (isdown) {
|
||||
if (currenttime >= *timer) {
|
||||
*timer = currenttime + 0.1;
|
||||
Key_Event(key, true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
*timer = 0;
|
||||
Key_Event(key, false);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (isdown)
|
||||
{
|
||||
} else {
|
||||
if (isdown) {
|
||||
*timer = currenttime + 0.5;
|
||||
Key_Event(key, true);
|
||||
}
|
||||
@@ -585,8 +529,7 @@ IN_Commands
|
||||
Emit key events for game controller buttons, including emulated buttons for analog sticks/triggers
|
||||
================
|
||||
*/
|
||||
void IN_Commands (void)
|
||||
{
|
||||
void IN_Commands(void) {
|
||||
#if defined(USE_SDL2)
|
||||
joyaxisstate_t newaxisstate;
|
||||
int i;
|
||||
@@ -600,34 +543,45 @@ void IN_Commands (void)
|
||||
return;
|
||||
|
||||
// emit key events for controller buttons
|
||||
for (i = 0; i < SDL_CONTROLLER_BUTTON_MAX; i++)
|
||||
{
|
||||
qboolean newstate = SDL_GameControllerGetButton(joy_active_controller, (SDL_GameControllerButton)i);
|
||||
for (i = 0; i < SDL_CONTROLLER_BUTTON_MAX; i++) {
|
||||
qboolean newstate = SDL_GameControllerGetButton(joy_active_controller, (SDL_GameControllerButton) i);
|
||||
qboolean oldstate = joy_buttonstate.buttondown[i];
|
||||
|
||||
joy_buttonstate.buttondown[i] = newstate;
|
||||
|
||||
// NOTE: This can cause a reentrant call of IN_Commands, via SCR_ModalMessage when confirming a new game.
|
||||
IN_JoyKeyEvent(oldstate, newstate, IN_KeyForControllerButton((SDL_GameControllerButton)i), &joy_buttontimer[i]);
|
||||
IN_JoyKeyEvent(oldstate, newstate, IN_KeyForControllerButton((SDL_GameControllerButton) i),
|
||||
&joy_buttontimer[i]);
|
||||
}
|
||||
|
||||
for (i = 0; i < SDL_CONTROLLER_AXIS_MAX; i++)
|
||||
{
|
||||
newaxisstate.axisvalue[i] = SDL_GameControllerGetAxis(joy_active_controller, (SDL_GameControllerAxis)i) / 32768.0f;
|
||||
for (i = 0; i < SDL_CONTROLLER_AXIS_MAX; i++) {
|
||||
newaxisstate.axisvalue[i] = SDL_GameControllerGetAxis(joy_active_controller, (SDL_GameControllerAxis) i) /
|
||||
32768.0f;
|
||||
}
|
||||
|
||||
// emit emulated arrow keys so the analog sticks can be used in the menu
|
||||
if (key_dest != key_game)
|
||||
{
|
||||
IN_JoyKeyEvent(joy_axisstate.axisvalue[SDL_CONTROLLER_AXIS_LEFTX] < -stickthreshold, newaxisstate.axisvalue[SDL_CONTROLLER_AXIS_LEFTX] < -stickthreshold, K_LEFTARROW, &joy_emulatedkeytimer[0]);
|
||||
IN_JoyKeyEvent(joy_axisstate.axisvalue[SDL_CONTROLLER_AXIS_LEFTX] > stickthreshold, newaxisstate.axisvalue[SDL_CONTROLLER_AXIS_LEFTX] > stickthreshold, K_RIGHTARROW, &joy_emulatedkeytimer[1]);
|
||||
IN_JoyKeyEvent(joy_axisstate.axisvalue[SDL_CONTROLLER_AXIS_LEFTY] < -stickthreshold, newaxisstate.axisvalue[SDL_CONTROLLER_AXIS_LEFTY] < -stickthreshold, K_UPARROW, &joy_emulatedkeytimer[2]);
|
||||
IN_JoyKeyEvent(joy_axisstate.axisvalue[SDL_CONTROLLER_AXIS_LEFTY] > stickthreshold, newaxisstate.axisvalue[SDL_CONTROLLER_AXIS_LEFTY] > stickthreshold, K_DOWNARROW, &joy_emulatedkeytimer[3]);
|
||||
if (key_dest != key_game) {
|
||||
IN_JoyKeyEvent(joy_axisstate.axisvalue[SDL_CONTROLLER_AXIS_LEFTX] < -stickthreshold,
|
||||
newaxisstate.axisvalue[SDL_CONTROLLER_AXIS_LEFTX] < -stickthreshold, K_LEFTARROW,
|
||||
&joy_emulatedkeytimer[0]);
|
||||
IN_JoyKeyEvent(joy_axisstate.axisvalue[SDL_CONTROLLER_AXIS_LEFTX] > stickthreshold,
|
||||
newaxisstate.axisvalue[SDL_CONTROLLER_AXIS_LEFTX] > stickthreshold, K_RIGHTARROW,
|
||||
&joy_emulatedkeytimer[1]);
|
||||
IN_JoyKeyEvent(joy_axisstate.axisvalue[SDL_CONTROLLER_AXIS_LEFTY] < -stickthreshold,
|
||||
newaxisstate.axisvalue[SDL_CONTROLLER_AXIS_LEFTY] < -stickthreshold, K_UPARROW,
|
||||
&joy_emulatedkeytimer[2]);
|
||||
IN_JoyKeyEvent(joy_axisstate.axisvalue[SDL_CONTROLLER_AXIS_LEFTY] > stickthreshold,
|
||||
newaxisstate.axisvalue[SDL_CONTROLLER_AXIS_LEFTY] > stickthreshold, K_DOWNARROW,
|
||||
&joy_emulatedkeytimer[3]);
|
||||
}
|
||||
|
||||
// emit emulated keys for the analog triggers
|
||||
IN_JoyKeyEvent(joy_axisstate.axisvalue[SDL_CONTROLLER_AXIS_TRIGGERLEFT] > triggerthreshold, newaxisstate.axisvalue[SDL_CONTROLLER_AXIS_TRIGGERLEFT] > triggerthreshold, K_LTRIGGER, &joy_emulatedkeytimer[4]);
|
||||
IN_JoyKeyEvent(joy_axisstate.axisvalue[SDL_CONTROLLER_AXIS_TRIGGERRIGHT] > triggerthreshold, newaxisstate.axisvalue[SDL_CONTROLLER_AXIS_TRIGGERRIGHT] > triggerthreshold, K_RTRIGGER, &joy_emulatedkeytimer[5]);
|
||||
IN_JoyKeyEvent(joy_axisstate.axisvalue[SDL_CONTROLLER_AXIS_TRIGGERLEFT] > triggerthreshold,
|
||||
newaxisstate.axisvalue[SDL_CONTROLLER_AXIS_TRIGGERLEFT] > triggerthreshold, K_LTRIGGER,
|
||||
&joy_emulatedkeytimer[4]);
|
||||
IN_JoyKeyEvent(joy_axisstate.axisvalue[SDL_CONTROLLER_AXIS_TRIGGERRIGHT] > triggerthreshold,
|
||||
newaxisstate.axisvalue[SDL_CONTROLLER_AXIS_TRIGGERRIGHT] > triggerthreshold, K_RTRIGGER,
|
||||
&joy_emulatedkeytimer[5]);
|
||||
|
||||
joy_axisstate = newaxisstate;
|
||||
#endif
|
||||
@@ -638,13 +592,12 @@ void IN_Commands (void)
|
||||
IN_JoyMove
|
||||
================
|
||||
*/
|
||||
void IN_JoyMove (usercmd_t *cmd)
|
||||
{
|
||||
void IN_JoyMove(usercmd_t *cmd) {
|
||||
#if defined(USE_SDL2)
|
||||
float speed;
|
||||
joyaxis_t moveRaw, moveDeadzone, moveEased;
|
||||
joyaxis_t lookRaw, lookDeadzone, lookEased;
|
||||
extern cvar_t sv_maxspeed;
|
||||
extern convar sv_maxspeed;
|
||||
|
||||
if (!joy_enable.value)
|
||||
return;
|
||||
@@ -660,8 +613,7 @@ void IN_JoyMove (usercmd_t *cmd)
|
||||
lookRaw.x = joy_axisstate.axisvalue[SDL_CONTROLLER_AXIS_RIGHTX];
|
||||
lookRaw.y = joy_axisstate.axisvalue[SDL_CONTROLLER_AXIS_RIGHTY];
|
||||
|
||||
if (joy_swapmovelook.value)
|
||||
{
|
||||
if (joy_swapmovelook.value) {
|
||||
joyaxis_t temp = moveRaw;
|
||||
moveRaw = lookRaw;
|
||||
lookRaw = temp;
|
||||
@@ -678,7 +630,7 @@ void IN_JoyMove (usercmd_t *cmd)
|
||||
speed = sv_maxspeed.value;
|
||||
else if (cl_forwardspeed.value >= sv_maxspeed.value)
|
||||
// not running, with always run = vanilla
|
||||
speed = q_min(sv_maxspeed.value, cl_forwardspeed.value / cl_movespeedkey.value);
|
||||
speed = std::min(sv_maxspeed.value, cl_forwardspeed.value / cl_movespeedkey.value);
|
||||
else
|
||||
// not running, with always run = off or quakespasm
|
||||
speed = cl_forwardspeed.value;
|
||||
@@ -687,7 +639,8 @@ void IN_JoyMove (usercmd_t *cmd)
|
||||
cmd->forwardmove -= speed * moveEased.y;
|
||||
|
||||
cl.viewangles[YAW] -= lookEased.x * joy_sensitivity_yaw.value * host_frametime;
|
||||
cl.viewangles[PITCH] += lookEased.y * joy_sensitivity_pitch.value * (joy_invert.value ? -1.0 : 1.0) * host_frametime;
|
||||
cl.viewangles[PITCH] += lookEased.y * joy_sensitivity_pitch.value * (joy_invert.value ? -1.0 : 1.0) *
|
||||
host_frametime;
|
||||
|
||||
if (lookEased.x != 0 || lookEased.y != 0)
|
||||
V_StopPitchDrift();
|
||||
@@ -700,8 +653,7 @@ void IN_JoyMove (usercmd_t *cmd)
|
||||
#endif
|
||||
}
|
||||
|
||||
void IN_MouseMove(usercmd_t *cmd)
|
||||
{
|
||||
void IN_MouseMove(usercmd_t *cmd) {
|
||||
float dmx, dmy;
|
||||
|
||||
dmx = total_dx * sensitivity.value;
|
||||
@@ -714,28 +666,24 @@ void IN_MouseMove(usercmd_t *cmd)
|
||||
if (cl.paused || key_dest != key_game)
|
||||
return;
|
||||
|
||||
if ( (in_strafe.state & 1) || (lookstrafe.value && (in_mlook.state & 1) ))
|
||||
if ((in_strafe.state & 1) || (lookstrafe.value && (in_mlook.state & 1)))
|
||||
cmd->sidemove += m_side.value * dmx;
|
||||
else
|
||||
cl.viewangles[YAW] -= m_yaw.value * dmx;
|
||||
|
||||
if (in_mlook.state & 1)
|
||||
{
|
||||
if (in_mlook.state & 1) {
|
||||
if (dmx || dmy)
|
||||
V_StopPitchDrift ();
|
||||
V_StopPitchDrift();
|
||||
}
|
||||
|
||||
if ( (in_mlook.state & 1) && !(in_strafe.state & 1))
|
||||
{
|
||||
if ((in_mlook.state & 1) && !(in_strafe.state & 1)) {
|
||||
cl.viewangles[PITCH] += m_pitch.value * dmy;
|
||||
/* johnfitz -- variable pitch clamping */
|
||||
if (cl.viewangles[PITCH] > cl_maxpitch.value)
|
||||
cl.viewangles[PITCH] = cl_maxpitch.value;
|
||||
if (cl.viewangles[PITCH] < cl_minpitch.value)
|
||||
cl.viewangles[PITCH] = cl_minpitch.value;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
if ((in_strafe.state & 1) && noclip_anglehack)
|
||||
cmd->upmove -= m_forward.value * dmy;
|
||||
else
|
||||
@@ -743,35 +691,28 @@ void IN_MouseMove(usercmd_t *cmd)
|
||||
}
|
||||
}
|
||||
|
||||
void IN_Move(usercmd_t *cmd)
|
||||
{
|
||||
void IN_Move(usercmd_t *cmd) {
|
||||
IN_JoyMove(cmd);
|
||||
IN_MouseMove(cmd);
|
||||
}
|
||||
|
||||
void IN_ClearStates (void)
|
||||
{
|
||||
void IN_ClearStates(void) {
|
||||
}
|
||||
|
||||
void IN_UpdateInputMode (void)
|
||||
{
|
||||
void IN_UpdateInputMode(void) {
|
||||
qboolean want_textmode = Key_TextEntry();
|
||||
if (textmode != want_textmode)
|
||||
{
|
||||
if (textmode != want_textmode) {
|
||||
textmode = want_textmode;
|
||||
#if !defined(USE_SDL2)
|
||||
SDL_EnableUNICODE(textmode);
|
||||
if (in_debugkeys.value)
|
||||
Con_Printf("SDL_EnableUNICODE %d time: %g\n", textmode, Sys_DoubleTime());
|
||||
#else
|
||||
if (textmode)
|
||||
{
|
||||
if (textmode) {
|
||||
SDL_StartTextInput();
|
||||
if (in_debugkeys.value)
|
||||
Con_Printf("SDL_StartTextInput time: %g\n", Sys_DoubleTime());
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
SDL_StopTextInput();
|
||||
if (in_debugkeys.value)
|
||||
Con_Printf("SDL_StopTextInput time: %g\n", Sys_DoubleTime());
|
||||
@@ -781,13 +722,11 @@ void IN_UpdateInputMode (void)
|
||||
}
|
||||
|
||||
#if !defined(USE_SDL2)
|
||||
static inline int IN_SDL_KeysymToQuakeKey(SDLKey sym)
|
||||
{
|
||||
static inline int IN_SDL_KeysymToQuakeKey(SDLKey sym) {
|
||||
if (sym > SDLK_SPACE && sym < SDLK_DELETE)
|
||||
return sym;
|
||||
|
||||
switch (sym)
|
||||
{
|
||||
switch (sym) {
|
||||
case SDLK_TAB: return K_TAB;
|
||||
case SDLK_RETURN: return K_ENTER;
|
||||
case SDLK_ESCAPE: return K_ESCAPE;
|
||||
@@ -828,7 +767,7 @@ static inline int IN_SDL_KeysymToQuakeKey(SDLKey sym)
|
||||
case SDLK_NUMLOCK: return K_KP_NUMLOCK;
|
||||
case SDLK_KP_DIVIDE: return K_KP_SLASH;
|
||||
case SDLK_KP_MULTIPLY: return K_KP_STAR;
|
||||
case SDLK_KP_MINUS:return K_KP_MINUS;
|
||||
case SDLK_KP_MINUS: return K_KP_MINUS;
|
||||
case SDLK_KP7: return K_KP_HOME;
|
||||
case SDLK_KP8: return K_KP_UPARROW;
|
||||
case SDLK_KP9: return K_KP_PGUP;
|
||||
@@ -857,10 +796,8 @@ static inline int IN_SDL_KeysymToQuakeKey(SDLKey sym)
|
||||
#endif
|
||||
|
||||
#if defined(USE_SDL2)
|
||||
static inline int IN_SDL2_ScancodeToQuakeKey(SDL_Scancode scancode)
|
||||
{
|
||||
switch (scancode)
|
||||
{
|
||||
static inline int IN_SDL2_ScancodeToQuakeKey(SDL_Scancode scancode) {
|
||||
switch (scancode) {
|
||||
case SDL_SCANCODE_TAB: return K_TAB;
|
||||
case SDL_SCANCODE_RETURN: return K_ENTER;
|
||||
case SDL_SCANCODE_RETURN2: return K_ENTER;
|
||||
@@ -980,64 +917,52 @@ static inline int IN_SDL2_ScancodeToQuakeKey(SDL_Scancode scancode)
|
||||
#endif
|
||||
|
||||
#if defined(USE_SDL2)
|
||||
static void IN_DebugTextEvent(SDL_Event *event)
|
||||
{
|
||||
Con_Printf ("SDL_TEXTINPUT '%s' time: %g\n", event->text.text, Sys_DoubleTime());
|
||||
static void IN_DebugTextEvent(SDL_Event *event) {
|
||||
Con_Printf("SDL_TEXTINPUT '%s' time: %g\n", event->text.text, Sys_DoubleTime());
|
||||
}
|
||||
#endif
|
||||
|
||||
static void IN_DebugKeyEvent(SDL_Event *event)
|
||||
{
|
||||
static void IN_DebugKeyEvent(SDL_Event *event) {
|
||||
const char *eventtype = (event->key.state == SDL_PRESSED) ? "SDL_KEYDOWN" : "SDL_KEYUP";
|
||||
#if defined(USE_SDL2)
|
||||
Con_Printf ("%s scancode: '%s' keycode: '%s' time: %g\n",
|
||||
Con_Printf("%s scancode: '%s' keycode: '%s' time: %g\n",
|
||||
eventtype,
|
||||
SDL_GetScancodeName(event->key.keysym.scancode),
|
||||
SDL_GetKeyName(event->key.keysym.sym),
|
||||
Sys_DoubleTime());
|
||||
#else
|
||||
Con_Printf ("%s sym: '%s' unicode: %04x time: %g\n",
|
||||
Con_Printf("%s sym: '%s' unicode: %04x time: %g\n",
|
||||
eventtype,
|
||||
SDL_GetKeyName(event->key.keysym.sym),
|
||||
(int)event->key.keysym.unicode,
|
||||
(int) event->key.keysym.unicode,
|
||||
Sys_DoubleTime());
|
||||
#endif
|
||||
}
|
||||
|
||||
void IN_SendKeyEvents (void)
|
||||
{
|
||||
void IN_SendKeyEvents(void) {
|
||||
SDL_Event event;
|
||||
int key;
|
||||
qboolean down;
|
||||
|
||||
while (SDL_PollEvent(&event))
|
||||
{
|
||||
switch (event.type)
|
||||
{
|
||||
while (SDL_PollEvent(&event)) {
|
||||
switch (event.type) {
|
||||
#if defined(USE_SDL2)
|
||||
case SDL_WINDOWEVENT:
|
||||
if (event.window.event == SDL_WINDOWEVENT_FOCUS_GAINED)
|
||||
{
|
||||
if (event.window.event == SDL_WINDOWEVENT_FOCUS_GAINED) {
|
||||
windowhasfocus = true;
|
||||
S_UnblockSound();
|
||||
}
|
||||
else if (event.window.event == SDL_WINDOWEVENT_FOCUS_LOST)
|
||||
{
|
||||
} else if (event.window.event == SDL_WINDOWEVENT_FOCUS_LOST) {
|
||||
windowhasfocus = false;
|
||||
S_BlockSound();
|
||||
}
|
||||
break;
|
||||
#else
|
||||
case SDL_ACTIVEEVENT:
|
||||
if (event.active.state & (SDL_APPINPUTFOCUS|SDL_APPACTIVE))
|
||||
{
|
||||
if (event.active.gain)
|
||||
{
|
||||
if (event.active.state & (SDL_APPINPUTFOCUS | SDL_APPACTIVE)) {
|
||||
if (event.active.gain) {
|
||||
windowhasfocus = true;
|
||||
S_UnblockSound();
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
windowhasfocus = false;
|
||||
S_BlockSound();
|
||||
}
|
||||
@@ -1054,9 +979,9 @@ void IN_SendKeyEvents (void)
|
||||
// (shift for uppercase, etc.) for us.
|
||||
{
|
||||
unsigned char *ch;
|
||||
for (ch = (unsigned char *)event.text.text; *ch; ch++)
|
||||
for (ch = (unsigned char *) event.text.text; *ch; ch++)
|
||||
if ((*ch & ~0x7F) == 0)
|
||||
Char_Event (*ch);
|
||||
Char_Event(*ch);
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
@@ -1076,20 +1001,19 @@ void IN_SendKeyEvents (void)
|
||||
#endif
|
||||
|
||||
// also pass along the underlying keycode using the proper current layout for Y/N prompts.
|
||||
Key_EventWithKeycode (key, down, event.key.keysym.sym);
|
||||
Key_EventWithKeycode(key, down, event.key.keysym.sym);
|
||||
|
||||
#if !defined(USE_SDL2)
|
||||
if (down && (event.key.keysym.unicode & ~0x7F) == 0)
|
||||
Char_Event (event.key.keysym.unicode);
|
||||
Char_Event(event.key.keysym.unicode);
|
||||
#endif
|
||||
break;
|
||||
|
||||
case SDL_MOUSEBUTTONDOWN:
|
||||
case SDL_MOUSEBUTTONUP:
|
||||
if (event.button.button < 1 ||
|
||||
event.button.button > Q_COUNTOF(buttonremap))
|
||||
{
|
||||
Con_Printf ("Ignored event for mouse button %d\n",
|
||||
event.button.button > Q_COUNTOF(buttonremap)) {
|
||||
Con_Printf("Ignored event for mouse button %d\n",
|
||||
event.button.button);
|
||||
break;
|
||||
}
|
||||
@@ -1098,13 +1022,10 @@ void IN_SendKeyEvents (void)
|
||||
|
||||
#if defined(USE_SDL2)
|
||||
case SDL_MOUSEWHEEL:
|
||||
if (event.wheel.y > 0)
|
||||
{
|
||||
if (event.wheel.y > 0) {
|
||||
Key_Event(K_MWHEELUP, true);
|
||||
Key_Event(K_MWHEELUP, false);
|
||||
}
|
||||
else if (event.wheel.y < 0)
|
||||
{
|
||||
} else if (event.wheel.y < 0) {
|
||||
Key_Event(K_MWHEELDOWN, true);
|
||||
Key_Event(K_MWHEELDOWN, false);
|
||||
}
|
||||
@@ -1117,29 +1038,24 @@ void IN_SendKeyEvents (void)
|
||||
|
||||
#if defined(USE_SDL2)
|
||||
case SDL_CONTROLLERDEVICEADDED:
|
||||
if (joy_active_instaceid == -1)
|
||||
{
|
||||
if (joy_active_instaceid == -1) {
|
||||
joy_active_controller = SDL_GameControllerOpen(event.cdevice.which);
|
||||
if (joy_active_controller == NULL)
|
||||
Con_DPrintf("Couldn't open game controller\n");
|
||||
else
|
||||
{
|
||||
else {
|
||||
SDL_Joystick *joy;
|
||||
joy = SDL_GameControllerGetJoystick(joy_active_controller);
|
||||
joy_active_instaceid = SDL_JoystickInstanceID(joy);
|
||||
}
|
||||
}
|
||||
else
|
||||
} else
|
||||
Con_DPrintf("Ignoring SDL_CONTROLLERDEVICEADDED\n");
|
||||
break;
|
||||
case SDL_CONTROLLERDEVICEREMOVED:
|
||||
if (joy_active_instaceid != -1 && event.cdevice.which == joy_active_instaceid)
|
||||
{
|
||||
if (joy_active_instaceid != -1 && event.cdevice.which == joy_active_instaceid) {
|
||||
SDL_GameControllerClose(joy_active_controller);
|
||||
joy_active_controller = NULL;
|
||||
joy_active_instaceid = -1;
|
||||
}
|
||||
else
|
||||
} else
|
||||
Con_DPrintf("Ignoring SDL_CONTROLLERDEVICEREMOVED\n");
|
||||
break;
|
||||
case SDL_CONTROLLERDEVICEREMAPPED:
|
||||
@@ -1148,8 +1064,8 @@ void IN_SendKeyEvents (void)
|
||||
#endif
|
||||
|
||||
case SDL_QUIT:
|
||||
CL_Disconnect ();
|
||||
Sys_Quit ();
|
||||
CL_Disconnect();
|
||||
Sys_Quit();
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -1157,4 +1073,3 @@ void IN_SendKeyEvents (void)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+14
-13
@@ -628,6 +628,7 @@ void Key_SetBinding (int keynum, const char *binding)
|
||||
// allocate memory for new binding
|
||||
if (binding)
|
||||
keybindings[keynum] = Z_Strdup(binding);
|
||||
printf("%d is now %s\n", keynum, keybindings[keynum]);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -639,16 +640,16 @@ void Key_Unbind_f (void)
|
||||
{
|
||||
int b;
|
||||
|
||||
if (Cmd_Argc() != 2)
|
||||
if (command::argc() != 2)
|
||||
{
|
||||
Con_Printf ("unbind <key> : remove commands from a key\n");
|
||||
return;
|
||||
}
|
||||
|
||||
b = Key_StringToKeynum (Cmd_Argv(1));
|
||||
b = Key_StringToKeynum (command::argv(1)->c_str());
|
||||
if (b == -1)
|
||||
{
|
||||
Con_Printf ("\"%s\" isn't a valid key\n", Cmd_Argv(1));
|
||||
Con_Printf ("\"%s\" isn't a valid key\n", command::argv(1)->c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -697,26 +698,26 @@ void Key_Bind_f (void)
|
||||
int i, c, b;
|
||||
char cmd[1024];
|
||||
|
||||
c = Cmd_Argc();
|
||||
c = command::argc();
|
||||
|
||||
if (c != 2 && c != 3)
|
||||
{
|
||||
Con_Printf ("bind <key> [command] : attach a command to a key\n");
|
||||
return;
|
||||
}
|
||||
b = Key_StringToKeynum (Cmd_Argv(1));
|
||||
b = Key_StringToKeynum (command::argv(1)->c_str());
|
||||
if (b == -1)
|
||||
{
|
||||
Con_Printf ("\"%s\" isn't a valid key\n", Cmd_Argv(1));
|
||||
Con_Printf ("\"%s\" isn't a valid key\n", command::argv(1)->c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
if (c == 2)
|
||||
{
|
||||
if (keybindings[b])
|
||||
Con_Printf ("\"%s\" = \"%s\"\n", Cmd_Argv(1), keybindings[b] );
|
||||
Con_Printf ("\"%s\" = \"%s\"\n", command::argv(1)->c_str(), keybindings[b] );
|
||||
else
|
||||
Con_Printf ("\"%s\" is not bound\n", Cmd_Argv(1) );
|
||||
Con_Printf ("\"%s\" is not bound\n", command::argv(1)->c_str() );
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -724,7 +725,7 @@ void Key_Bind_f (void)
|
||||
cmd[0] = 0;
|
||||
for (i = 2; i < c; i++)
|
||||
{
|
||||
q_strlcat (cmd, Cmd_Argv(i), sizeof(cmd));
|
||||
q_strlcat (cmd, command::argv(i)->c_str(), sizeof(cmd));
|
||||
if (i != (c-1))
|
||||
q_strlcat (cmd, " ", sizeof(cmd));
|
||||
}
|
||||
@@ -890,10 +891,10 @@ void Key_Init (void)
|
||||
//
|
||||
// register our functions
|
||||
//
|
||||
Cmd_AddCommand ("bindlist",Key_Bindlist_f); //johnfitz
|
||||
Cmd_AddCommand ("bind",Key_Bind_f);
|
||||
Cmd_AddCommand ("unbind",Key_Unbind_f);
|
||||
Cmd_AddCommand ("unbindall",Key_Unbindall_f);
|
||||
command::add ("bindlist",Key_Bindlist_f); //johnfitz
|
||||
command::add ("bind",Key_Bind_f);
|
||||
command::add ("unbind",Key_Unbind_f);
|
||||
command::add ("unbindall",Key_Unbindall_f);
|
||||
}
|
||||
|
||||
static struct {
|
||||
|
||||
+777
-905
File diff suppressed because it is too large
Load Diff
@@ -5,6 +5,7 @@
|
||||
#define MINIZ_EXPORT
|
||||
#endif
|
||||
|
||||
|
||||
/* miniz.c 2.2.0 - public domain deflate/inflate, zlib-subset, ZIP reading/writing/appending, PNG writing
|
||||
See "unlicense" statement at the end of this file.
|
||||
Rich Geldreich <richgel99@gmail.com>, last updated Oct. 13, 2013
|
||||
|
||||
+1
-1
@@ -39,7 +39,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
extern int DEFAULTnet_hostport;
|
||||
extern int net_hostport;
|
||||
|
||||
extern cvar_t hostname;
|
||||
extern convar hostname;
|
||||
|
||||
extern double net_time;
|
||||
extern sizebuf_t net_message;
|
||||
|
||||
+243
-376
File diff suppressed because it is too large
Load Diff
+148
-243
@@ -46,8 +46,10 @@ qboolean slistLocal = true;
|
||||
static double slistStartTime;
|
||||
static int slistLastShown;
|
||||
|
||||
static void Slist_Send (void *);
|
||||
static void Slist_Poll (void *);
|
||||
static void Slist_Send(void *);
|
||||
|
||||
static void Slist_Poll(void *);
|
||||
|
||||
static PollProcedure slistSendProcedure = {NULL, 0.0, Slist_Send};
|
||||
static PollProcedure slistPollProcedure = {NULL, 0.0, Slist_Poll};
|
||||
|
||||
@@ -59,8 +61,8 @@ int messagesReceived = 0;
|
||||
int unreliableMessagesSent = 0;
|
||||
int unreliableMessagesReceived = 0;
|
||||
|
||||
static cvar_t net_messagetimeout = {"net_messagetimeout","300",CVAR_NONE};
|
||||
cvar_t hostname = {"hostname", "UNNAMED", CVAR_NONE};
|
||||
static convar net_messagetimeout = {"net_messagetimeout", "300"};
|
||||
convar hostname = {"hostname", "UNNAMED"};
|
||||
|
||||
// these two macros are to make the code more readable
|
||||
#define sfunc net_drivers[sock->driver]
|
||||
@@ -71,8 +73,7 @@ int net_driverlevel;
|
||||
double net_time;
|
||||
|
||||
|
||||
double SetNetTime (void)
|
||||
{
|
||||
double SetNetTime(void) {
|
||||
net_time = Sys_DoubleTime();
|
||||
return net_time;
|
||||
}
|
||||
@@ -86,8 +87,7 @@ Called by drivers when a new communications endpoint is required
|
||||
The sequence and buffer fields will be filled in properly
|
||||
===================
|
||||
*/
|
||||
qsocket_t *NET_NewQSocket (void)
|
||||
{
|
||||
qsocket_t *NET_NewQSocket(void) {
|
||||
qsocket_t *sock;
|
||||
|
||||
if (net_freeSockets == NULL)
|
||||
@@ -106,7 +106,7 @@ qsocket_t *NET_NewQSocket (void)
|
||||
|
||||
sock->disconnected = false;
|
||||
sock->connecttime = net_time;
|
||||
Q_strcpy (sock->address,"UNSET ADDRESS");
|
||||
Q_strcpy(sock->address, "UNSET ADDRESS");
|
||||
sock->driver = net_driverlevel;
|
||||
sock->socket = 0;
|
||||
sock->driverdata = NULL;
|
||||
@@ -125,26 +125,22 @@ qsocket_t *NET_NewQSocket (void)
|
||||
}
|
||||
|
||||
|
||||
void NET_FreeQSocket(qsocket_t *sock)
|
||||
{
|
||||
void NET_FreeQSocket(qsocket_t *sock) {
|
||||
qsocket_t *s;
|
||||
|
||||
// remove it from active list
|
||||
if (sock == net_activeSockets)
|
||||
net_activeSockets = net_activeSockets->next;
|
||||
else
|
||||
{
|
||||
for (s = net_activeSockets; s; s = s->next)
|
||||
{
|
||||
if (s->next == sock)
|
||||
{
|
||||
else {
|
||||
for (s = net_activeSockets; s; s = s->next) {
|
||||
if (s->next == sock) {
|
||||
s->next = sock->next;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!s)
|
||||
Sys_Error ("NET_FreeQSocket: not active");
|
||||
Sys_Error("NET_FreeQSocket: not active");
|
||||
}
|
||||
|
||||
// add it to free list
|
||||
@@ -154,121 +150,106 @@ void NET_FreeQSocket(qsocket_t *sock)
|
||||
}
|
||||
|
||||
|
||||
double NET_QSocketGetTime (const qsocket_t *s)
|
||||
{
|
||||
double NET_QSocketGetTime(const qsocket_t *s) {
|
||||
return s->connecttime;
|
||||
}
|
||||
|
||||
|
||||
const char *NET_QSocketGetAddressString (const qsocket_t *s)
|
||||
{
|
||||
const char *NET_QSocketGetAddressString(const qsocket_t *s) {
|
||||
return s->address;
|
||||
}
|
||||
|
||||
|
||||
static void NET_Listen_f (void)
|
||||
{
|
||||
if (Cmd_Argc () != 2)
|
||||
{
|
||||
Con_Printf ("\"listen\" is \"%d\"\n", listening ? 1 : 0);
|
||||
static void NET_Listen_f(void) {
|
||||
if (command::argc() != 2) {
|
||||
Con_Printf("\"listen\" is \"%d\"\n", listening ? 1 : 0);
|
||||
return;
|
||||
}
|
||||
|
||||
listening = Q_atoi(Cmd_Argv(1)) ? true : false;
|
||||
listening = Q_atoi(command::argv(1)->c_str()) ? true : false;
|
||||
|
||||
for (net_driverlevel = 0; net_driverlevel < net_numdrivers; net_driverlevel++)
|
||||
{
|
||||
for (net_driverlevel = 0; net_driverlevel < net_numdrivers; net_driverlevel++) {
|
||||
if (net_drivers[net_driverlevel].initialized == false)
|
||||
continue;
|
||||
dfunc.Listen (listening);
|
||||
dfunc.Listen(listening);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void MaxPlayers_f (void)
|
||||
{
|
||||
static void MaxPlayers_f(void) {
|
||||
int n;
|
||||
|
||||
if (Cmd_Argc () != 2)
|
||||
{
|
||||
Con_Printf ("\"maxplayers\" is \"%d\"\n", svs.maxclients);
|
||||
if (command::argc() != 2) {
|
||||
Con_Printf("\"maxplayers\" is \"%d\"\n", svs.maxclients);
|
||||
return;
|
||||
}
|
||||
|
||||
if (sv.active)
|
||||
{
|
||||
Con_Printf ("maxplayers can not be changed while a server is running.\n");
|
||||
if (sv.active) {
|
||||
Con_Printf("maxplayers can not be changed while a server is running.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
n = Q_atoi(Cmd_Argv(1));
|
||||
n = Q_atoi(command::argv(1)->c_str());
|
||||
if (n < 1)
|
||||
n = 1;
|
||||
if (n > svs.maxclientslimit)
|
||||
{
|
||||
if (n > svs.maxclientslimit) {
|
||||
n = svs.maxclientslimit;
|
||||
Con_Printf ("\"maxplayers\" set to \"%d\"\n", n);
|
||||
Con_Printf("\"maxplayers\" set to \"%d\"\n", n);
|
||||
}
|
||||
|
||||
if ((n == 1) && listening)
|
||||
Cbuf_AddText ("listen 0\n");
|
||||
Cbuf_AddText("listen 0\n");
|
||||
|
||||
if ((n > 1) && (!listening))
|
||||
Cbuf_AddText ("listen 1\n");
|
||||
Cbuf_AddText("listen 1\n");
|
||||
|
||||
svs.maxclients = n;
|
||||
if (n == 1)
|
||||
Cvar_Set ("deathmatch", "0");
|
||||
convar::set("deathmatch", "0");
|
||||
else
|
||||
Cvar_Set ("deathmatch", "1");
|
||||
convar::set("deathmatch", "1");
|
||||
}
|
||||
|
||||
|
||||
static void NET_Port_f (void)
|
||||
{
|
||||
static void NET_Port_f(void) {
|
||||
int n;
|
||||
|
||||
if (Cmd_Argc () != 2)
|
||||
{
|
||||
Con_Printf ("\"port\" is \"%d\"\n", net_hostport);
|
||||
if (command::argc() != 2) {
|
||||
Con_Printf("\"port\" is \"%d\"\n", net_hostport);
|
||||
return;
|
||||
}
|
||||
|
||||
n = Q_atoi(Cmd_Argv(1));
|
||||
if (n < 1 || n > 65534)
|
||||
{
|
||||
Con_Printf ("Bad value, must be between 1 and 65534\n");
|
||||
n = Q_atoi(command::argv(1)->c_str());
|
||||
if (n < 1 || n > 65534) {
|
||||
Con_Printf("Bad value, must be between 1 and 65534\n");
|
||||
return;
|
||||
}
|
||||
|
||||
DEFAULTnet_hostport = n;
|
||||
net_hostport = n;
|
||||
|
||||
if (listening)
|
||||
{
|
||||
if (listening) {
|
||||
// force a change to the new port
|
||||
Cbuf_AddText ("listen 0\n");
|
||||
Cbuf_AddText ("listen 1\n");
|
||||
Cbuf_AddText("listen 0\n");
|
||||
Cbuf_AddText("listen 1\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void PrintSlistHeader(void)
|
||||
{
|
||||
static void PrintSlistHeader(void) {
|
||||
Con_Printf("Server Map Users\n");
|
||||
Con_Printf("--------------- --------------- -----\n");
|
||||
slistLastShown = 0;
|
||||
}
|
||||
|
||||
|
||||
static void PrintSlist(void)
|
||||
{
|
||||
static void PrintSlist(void) {
|
||||
int n;
|
||||
|
||||
for (n = slistLastShown; n < hostCacheCount; n++)
|
||||
{
|
||||
for (n = slistLastShown; n < hostCacheCount; n++) {
|
||||
if (hostcache[n].maxusers)
|
||||
Con_Printf("%-15.15s %-15.15s %2u/%2u\n", hostcache[n].name, hostcache[n].map, hostcache[n].users, hostcache[n].maxusers);
|
||||
Con_Printf("%-15.15s %-15.15s %2u/%2u\n", hostcache[n].name, hostcache[n].map, hostcache[n].users,
|
||||
hostcache[n].maxusers);
|
||||
else
|
||||
Con_Printf("%-15.15s %-15.15s\n", hostcache[n].name, hostcache[n].map);
|
||||
}
|
||||
@@ -276,8 +257,7 @@ static void PrintSlist(void)
|
||||
}
|
||||
|
||||
|
||||
static void PrintSlistTrailer(void)
|
||||
{
|
||||
static void PrintSlistTrailer(void) {
|
||||
if (hostCacheCount)
|
||||
Con_Printf("== end list ==\n\n");
|
||||
else
|
||||
@@ -285,13 +265,11 @@ static void PrintSlistTrailer(void)
|
||||
}
|
||||
|
||||
|
||||
void NET_Slist_f (void)
|
||||
{
|
||||
void NET_Slist_f(void) {
|
||||
if (slistInProgress)
|
||||
return;
|
||||
|
||||
if (! slistSilent)
|
||||
{
|
||||
if (!slistSilent) {
|
||||
Con_Printf("Looking for Quake servers...\n");
|
||||
PrintSlistHeader();
|
||||
}
|
||||
@@ -306,18 +284,13 @@ void NET_Slist_f (void)
|
||||
}
|
||||
|
||||
|
||||
void NET_SlistSort (void)
|
||||
{
|
||||
if (hostCacheCount > 1)
|
||||
{
|
||||
void NET_SlistSort(void) {
|
||||
if (hostCacheCount > 1) {
|
||||
int i, j;
|
||||
hostcache_t temp;
|
||||
for (i = 0; i < hostCacheCount; i++)
|
||||
{
|
||||
for (j = i + 1; j < hostCacheCount; j++)
|
||||
{
|
||||
if (strcmp(hostcache[j].name, hostcache[i].name) < 0)
|
||||
{
|
||||
for (i = 0; i < hostCacheCount; i++) {
|
||||
for (j = i + 1; j < hostCacheCount; j++) {
|
||||
if (strcmp(hostcache[j].name, hostcache[i].name) < 0) {
|
||||
memcpy(&temp, &hostcache[j], sizeof(hostcache_t));
|
||||
memcpy(&hostcache[j], &hostcache[i], sizeof(hostcache_t));
|
||||
memcpy(&hostcache[i], &temp, sizeof(hostcache_t));
|
||||
@@ -328,21 +301,17 @@ void NET_SlistSort (void)
|
||||
}
|
||||
|
||||
|
||||
const char *NET_SlistPrintServer (int idx)
|
||||
{
|
||||
const char *NET_SlistPrintServer(int idx) {
|
||||
static char string[64];
|
||||
|
||||
if (idx < 0 || idx >= hostCacheCount)
|
||||
return "";
|
||||
|
||||
if (hostcache[idx].maxusers)
|
||||
{
|
||||
if (hostcache[idx].maxusers) {
|
||||
q_snprintf(string, sizeof(string), "%-15.15s %-15.15s %2u/%2u\n",
|
||||
hostcache[idx].name, hostcache[idx].map,
|
||||
hostcache[idx].users, hostcache[idx].maxusers);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
q_snprintf(string, sizeof(string), "%-15.15s %-15.15s\n",
|
||||
hostcache[idx].name, hostcache[idx].map);
|
||||
}
|
||||
@@ -351,23 +320,20 @@ const char *NET_SlistPrintServer (int idx)
|
||||
}
|
||||
|
||||
|
||||
const char *NET_SlistPrintServerName (int idx)
|
||||
{
|
||||
const char *NET_SlistPrintServerName(int idx) {
|
||||
if (idx < 0 || idx >= hostCacheCount)
|
||||
return "";
|
||||
return hostcache[idx].cname;
|
||||
}
|
||||
|
||||
|
||||
static void Slist_Send (void *unused)
|
||||
{
|
||||
for (net_driverlevel = 0; net_driverlevel < net_numdrivers; net_driverlevel++)
|
||||
{
|
||||
static void Slist_Send(void *unused) {
|
||||
for (net_driverlevel = 0; net_driverlevel < net_numdrivers; net_driverlevel++) {
|
||||
if (!slistLocal && IS_LOOP_DRIVER(net_driverlevel))
|
||||
continue;
|
||||
if (net_drivers[net_driverlevel].initialized == false)
|
||||
continue;
|
||||
dfunc.SearchForHosts (true);
|
||||
dfunc.SearchForHosts(true);
|
||||
}
|
||||
|
||||
if ((Sys_DoubleTime() - slistStartTime) < 0.5)
|
||||
@@ -375,27 +341,24 @@ static void Slist_Send (void *unused)
|
||||
}
|
||||
|
||||
|
||||
static void Slist_Poll (void *unused)
|
||||
{
|
||||
for (net_driverlevel = 0; net_driverlevel < net_numdrivers; net_driverlevel++)
|
||||
{
|
||||
static void Slist_Poll(void *unused) {
|
||||
for (net_driverlevel = 0; net_driverlevel < net_numdrivers; net_driverlevel++) {
|
||||
if (!slistLocal && IS_LOOP_DRIVER(net_driverlevel))
|
||||
continue;
|
||||
if (net_drivers[net_driverlevel].initialized == false)
|
||||
continue;
|
||||
dfunc.SearchForHosts (false);
|
||||
dfunc.SearchForHosts(false);
|
||||
}
|
||||
|
||||
if (! slistSilent)
|
||||
if (!slistSilent)
|
||||
PrintSlist();
|
||||
|
||||
if ((Sys_DoubleTime() - slistStartTime) < 1.5)
|
||||
{
|
||||
if ((Sys_DoubleTime() - slistStartTime) < 1.5) {
|
||||
SchedulePollProcedure(&slistPollProcedure, 0.1);
|
||||
return;
|
||||
}
|
||||
|
||||
if (! slistSilent)
|
||||
if (!slistSilent)
|
||||
PrintSlistTrailer();
|
||||
slistInProgress = false;
|
||||
slistSilent = false;
|
||||
@@ -412,8 +375,7 @@ NET_Connect
|
||||
int hostCacheCount = 0;
|
||||
hostcache_t hostcache[HOSTCACHESIZE];
|
||||
|
||||
qsocket_t *NET_Connect (const char *host)
|
||||
{
|
||||
qsocket_t *NET_Connect(const char *host) {
|
||||
qsocket_t *ret;
|
||||
int n;
|
||||
int numdrivers = net_numdrivers;
|
||||
@@ -423,19 +385,15 @@ qsocket_t *NET_Connect (const char *host)
|
||||
if (host && *host == 0)
|
||||
host = NULL;
|
||||
|
||||
if (host)
|
||||
{
|
||||
if (q_strcasecmp (host, "local") == 0)
|
||||
{
|
||||
if (host) {
|
||||
if (q_strcasecmp(host, "local") == 0) {
|
||||
numdrivers = 1;
|
||||
goto JustDoIt;
|
||||
}
|
||||
|
||||
if (hostCacheCount)
|
||||
{
|
||||
if (hostCacheCount) {
|
||||
for (n = 0; n < hostCacheCount; n++)
|
||||
if (q_strcasecmp (host, hostcache[n].name) == 0)
|
||||
{
|
||||
if (q_strcasecmp(host, hostcache[n].name) == 0) {
|
||||
host = hostcache[n].cname;
|
||||
break;
|
||||
}
|
||||
@@ -445,25 +403,21 @@ qsocket_t *NET_Connect (const char *host)
|
||||
}
|
||||
|
||||
slistSilent = host ? true : false;
|
||||
NET_Slist_f ();
|
||||
NET_Slist_f();
|
||||
|
||||
while (slistInProgress)
|
||||
NET_Poll();
|
||||
|
||||
if (host == NULL)
|
||||
{
|
||||
if (host == NULL) {
|
||||
if (hostCacheCount != 1)
|
||||
return NULL;
|
||||
host = hostcache[0].cname;
|
||||
Con_Printf("Connecting to...\n%s @ %s\n\n", hostcache[0].name, host);
|
||||
}
|
||||
|
||||
if (hostCacheCount)
|
||||
{
|
||||
for (n = 0; n < hostCacheCount; n++)
|
||||
{
|
||||
if (q_strcasecmp (host, hostcache[n].name) == 0)
|
||||
{
|
||||
if (hostCacheCount) {
|
||||
for (n = 0; n < hostCacheCount; n++) {
|
||||
if (q_strcasecmp(host, hostcache[n].name) == 0) {
|
||||
host = hostcache[n].cname;
|
||||
break;
|
||||
}
|
||||
@@ -471,17 +425,15 @@ qsocket_t *NET_Connect (const char *host)
|
||||
}
|
||||
|
||||
JustDoIt:
|
||||
for (net_driverlevel = 0; net_driverlevel < numdrivers; net_driverlevel++)
|
||||
{
|
||||
for (net_driverlevel = 0; net_driverlevel < numdrivers; net_driverlevel++) {
|
||||
if (net_drivers[net_driverlevel].initialized == false)
|
||||
continue;
|
||||
ret = dfunc.Connect (host);
|
||||
ret = dfunc.Connect(host);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (host)
|
||||
{
|
||||
if (host) {
|
||||
Con_Printf("\n");
|
||||
PrintSlistHeader();
|
||||
PrintSlist();
|
||||
@@ -497,21 +449,18 @@ JustDoIt:
|
||||
NET_CheckNewConnections
|
||||
===================
|
||||
*/
|
||||
qsocket_t *NET_CheckNewConnections (void)
|
||||
{
|
||||
qsocket_t *NET_CheckNewConnections(void) {
|
||||
qsocket_t *ret;
|
||||
|
||||
SetNetTime();
|
||||
|
||||
for (net_driverlevel = 0; net_driverlevel < net_numdrivers; net_driverlevel++)
|
||||
{
|
||||
for (net_driverlevel = 0; net_driverlevel < net_numdrivers; net_driverlevel++) {
|
||||
if (net_drivers[net_driverlevel].initialized == false)
|
||||
continue;
|
||||
if (!IS_LOOP_DRIVER(net_driverlevel) && listening == false)
|
||||
continue;
|
||||
ret = dfunc.CheckNewConnections ();
|
||||
if (ret)
|
||||
{
|
||||
ret = dfunc.CheckNewConnections();
|
||||
if (ret) {
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
@@ -524,8 +473,7 @@ qsocket_t *NET_CheckNewConnections (void)
|
||||
NET_Close
|
||||
===================
|
||||
*/
|
||||
void NET_Close (qsocket_t *sock)
|
||||
{
|
||||
void NET_Close(qsocket_t *sock) {
|
||||
if (!sock)
|
||||
return;
|
||||
|
||||
@@ -535,7 +483,7 @@ void NET_Close (qsocket_t *sock)
|
||||
SetNetTime();
|
||||
|
||||
// call the driver_Close function
|
||||
sfunc.Close (sock);
|
||||
sfunc.Close(sock);
|
||||
|
||||
NET_FreeQSocket(sock);
|
||||
}
|
||||
@@ -552,15 +500,13 @@ returns 1 if a message was received
|
||||
returns -1 if connection is invalid
|
||||
=================
|
||||
*/
|
||||
int NET_GetMessage (qsocket_t *sock)
|
||||
{
|
||||
int NET_GetMessage(qsocket_t *sock) {
|
||||
int ret;
|
||||
|
||||
if (!sock)
|
||||
return -1;
|
||||
|
||||
if (sock->disconnected)
|
||||
{
|
||||
if (sock->disconnected) {
|
||||
Con_Printf("NET_GetMessage: disconnected socket\n");
|
||||
return -1;
|
||||
}
|
||||
@@ -570,19 +516,15 @@ int NET_GetMessage (qsocket_t *sock)
|
||||
ret = sfunc.QGetMessage(sock);
|
||||
|
||||
// see if this connection has timed out
|
||||
if (ret == 0 && !IS_LOOP_DRIVER(sock->driver))
|
||||
{
|
||||
if (net_time - sock->lastMessageTime > net_messagetimeout.value)
|
||||
{
|
||||
if (ret == 0 && !IS_LOOP_DRIVER(sock->driver)) {
|
||||
if (net_time - sock->lastMessageTime > net_messagetimeout.value) {
|
||||
NET_Close(sock);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (ret > 0)
|
||||
{
|
||||
if (!IS_LOOP_DRIVER(sock->driver))
|
||||
{
|
||||
if (ret > 0) {
|
||||
if (!IS_LOOP_DRIVER(sock->driver)) {
|
||||
sock->lastMessageTime = net_time;
|
||||
if (ret == 1)
|
||||
messagesReceived++;
|
||||
@@ -606,15 +548,13 @@ returns 1 if the message was sent properly
|
||||
returns -1 if the connection died
|
||||
==================
|
||||
*/
|
||||
int NET_SendMessage (qsocket_t *sock, sizebuf_t *data)
|
||||
{
|
||||
int NET_SendMessage(qsocket_t *sock, sizebuf_t *data) {
|
||||
int r;
|
||||
|
||||
if (!sock)
|
||||
return -1;
|
||||
|
||||
if (sock->disconnected)
|
||||
{
|
||||
if (sock->disconnected) {
|
||||
Con_Printf("NET_SendMessage: disconnected socket\n");
|
||||
return -1;
|
||||
}
|
||||
@@ -628,15 +568,13 @@ int NET_SendMessage (qsocket_t *sock, sizebuf_t *data)
|
||||
}
|
||||
|
||||
|
||||
int NET_SendUnreliableMessage (qsocket_t *sock, sizebuf_t *data)
|
||||
{
|
||||
int NET_SendUnreliableMessage(qsocket_t *sock, sizebuf_t *data) {
|
||||
int r;
|
||||
|
||||
if (!sock)
|
||||
return -1;
|
||||
|
||||
if (sock->disconnected)
|
||||
{
|
||||
if (sock->disconnected) {
|
||||
Con_Printf("NET_SendMessage: disconnected socket\n");
|
||||
return -1;
|
||||
}
|
||||
@@ -658,8 +596,7 @@ Returns true or false if the given qsocket can currently accept a
|
||||
message to be transmitted.
|
||||
==================
|
||||
*/
|
||||
qboolean NET_CanSendMessage (qsocket_t *sock)
|
||||
{
|
||||
qboolean NET_CanSendMessage(qsocket_t *sock) {
|
||||
if (!sock)
|
||||
return false;
|
||||
|
||||
@@ -672,25 +609,21 @@ qboolean NET_CanSendMessage (qsocket_t *sock)
|
||||
}
|
||||
|
||||
|
||||
int NET_SendToAll (sizebuf_t *data, double blocktime)
|
||||
{
|
||||
int NET_SendToAll(sizebuf_t *data, double blocktime) {
|
||||
double start;
|
||||
int i;
|
||||
int count = 0;
|
||||
qboolean msg_init[MAX_SCOREBOARD]; /* did we write the message to the client's connection */
|
||||
qboolean msg_sent[MAX_SCOREBOARD]; /* did the msg arrive its destination (canSend state). */
|
||||
|
||||
for (i = 0, host_client = svs.clients; i < svs.maxclients; i++, host_client++)
|
||||
{
|
||||
for (i = 0, host_client = svs.clients; i < svs.maxclients; i++, host_client++) {
|
||||
/*
|
||||
if (!host_client->netconnection)
|
||||
continue;
|
||||
if (host_client->active)
|
||||
*/
|
||||
if (host_client->netconnection && host_client->active)
|
||||
{
|
||||
if (IS_LOOP_DRIVER(host_client->netconnection->driver))
|
||||
{
|
||||
if (host_client->netconnection && host_client->active) {
|
||||
if (IS_LOOP_DRIVER(host_client->netconnection->driver)) {
|
||||
NET_SendMessage(host_client->netconnection, data);
|
||||
msg_init[i] = true;
|
||||
msg_sent[i] = true;
|
||||
@@ -699,44 +632,32 @@ int NET_SendToAll (sizebuf_t *data, double blocktime)
|
||||
count++;
|
||||
msg_init[i] = false;
|
||||
msg_sent[i] = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
msg_init[i] = true;
|
||||
msg_sent[i] = true;
|
||||
}
|
||||
}
|
||||
|
||||
start = Sys_DoubleTime();
|
||||
while (count)
|
||||
{
|
||||
while (count) {
|
||||
count = 0;
|
||||
for (i = 0, host_client = svs.clients; i < svs.maxclients; i++, host_client++)
|
||||
{
|
||||
if (! msg_init[i])
|
||||
{
|
||||
if (NET_CanSendMessage (host_client->netconnection))
|
||||
{
|
||||
for (i = 0, host_client = svs.clients; i < svs.maxclients; i++, host_client++) {
|
||||
if (!msg_init[i]) {
|
||||
if (NET_CanSendMessage(host_client->netconnection)) {
|
||||
msg_init[i] = true;
|
||||
NET_SendMessage(host_client->netconnection, data);
|
||||
}
|
||||
else
|
||||
{
|
||||
NET_GetMessage (host_client->netconnection);
|
||||
} else {
|
||||
NET_GetMessage(host_client->netconnection);
|
||||
}
|
||||
count++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (! msg_sent[i])
|
||||
{
|
||||
if (NET_CanSendMessage (host_client->netconnection))
|
||||
{
|
||||
if (!msg_sent[i]) {
|
||||
if (NET_CanSendMessage(host_client->netconnection)) {
|
||||
msg_sent[i] = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
NET_GetMessage (host_client->netconnection);
|
||||
} else {
|
||||
NET_GetMessage(host_client->netconnection);
|
||||
}
|
||||
count++;
|
||||
continue;
|
||||
@@ -757,23 +678,21 @@ NET_Init
|
||||
====================
|
||||
*/
|
||||
|
||||
void NET_Init (void)
|
||||
{
|
||||
void NET_Init(void) {
|
||||
int i;
|
||||
qsocket_t *s;
|
||||
|
||||
i = COM_CheckParm ("-port");
|
||||
i = COM_CheckParm("-port");
|
||||
if (!i)
|
||||
i = COM_CheckParm ("-udpport");
|
||||
i = COM_CheckParm("-udpport");
|
||||
if (!i)
|
||||
i = COM_CheckParm ("-ipxport");
|
||||
i = COM_CheckParm("-ipxport");
|
||||
|
||||
if (i)
|
||||
{
|
||||
if (i < com_argc-1)
|
||||
DEFAULTnet_hostport = Q_atoi (com_argv[i+1]);
|
||||
if (i) {
|
||||
if (i < com_argc - 1)
|
||||
DEFAULTnet_hostport = Q_atoi(com_argv[i + 1]);
|
||||
else
|
||||
Sys_Error ("NET_Init: you must specify a number after -port");
|
||||
Sys_Error("NET_Init: you must specify a number after -port");
|
||||
}
|
||||
net_hostport = DEFAULTnet_hostport;
|
||||
|
||||
@@ -785,51 +704,46 @@ void NET_Init (void)
|
||||
|
||||
SetNetTime();
|
||||
|
||||
for (i = 0; i < net_numsockets; i++)
|
||||
{
|
||||
s = (qsocket_t *)Hunk_AllocName(sizeof(qsocket_t), "qsocket");
|
||||
for (i = 0; i < net_numsockets; i++) {
|
||||
s = (qsocket_t *) Hunk_AllocName(sizeof(qsocket_t), "qsocket");
|
||||
s->next = net_freeSockets;
|
||||
net_freeSockets = s;
|
||||
s->disconnected = true;
|
||||
}
|
||||
|
||||
// allocate space for network message buffer
|
||||
SZ_Alloc (&net_message, NET_MAXMESSAGE);
|
||||
SZ_Alloc(&net_message, NET_MAXMESSAGE);
|
||||
|
||||
Cvar_RegisterVariable (&net_messagetimeout);
|
||||
Cvar_RegisterVariable (&hostname);
|
||||
net_messagetimeout.inscribe();
|
||||
hostname.inscribe();
|
||||
|
||||
Cmd_AddCommand ("slist", NET_Slist_f);
|
||||
Cmd_AddCommand ("listen", NET_Listen_f);
|
||||
Cmd_AddCommand ("maxplayers", MaxPlayers_f);
|
||||
Cmd_AddCommand ("port", NET_Port_f);
|
||||
command::add("slist", NET_Slist_f);
|
||||
command::add("listen", NET_Listen_f);
|
||||
command::add("maxplayers", MaxPlayers_f);
|
||||
command::add("port", NET_Port_f);
|
||||
|
||||
// initialize all the drivers
|
||||
for (i = net_driverlevel = 0; net_driverlevel < net_numdrivers; net_driverlevel++)
|
||||
{
|
||||
for (i = net_driverlevel = 0; net_driverlevel < net_numdrivers; net_driverlevel++) {
|
||||
if (net_drivers[net_driverlevel].Init() == -1)
|
||||
continue;
|
||||
i++;
|
||||
net_drivers[net_driverlevel].initialized = true;
|
||||
if (listening)
|
||||
net_drivers[net_driverlevel].Listen (true);
|
||||
net_drivers[net_driverlevel].Listen(true);
|
||||
}
|
||||
|
||||
/* Loop_Init() returns -1 for dedicated server case,
|
||||
* therefore the i == 0 check is correct */
|
||||
if (i == 0
|
||||
&& cls.state == ca_dedicated
|
||||
)
|
||||
{
|
||||
) {
|
||||
Sys_Error("Network not available!");
|
||||
}
|
||||
|
||||
if (*my_ipx_address)
|
||||
{
|
||||
if (*my_ipx_address) {
|
||||
Con_DPrintf("IPX address %s\n", my_ipx_address);
|
||||
}
|
||||
if (*my_tcpip_address)
|
||||
{
|
||||
if (*my_tcpip_address) {
|
||||
Con_DPrintf("TCP/IP address %s\n", my_tcpip_address);
|
||||
}
|
||||
}
|
||||
@@ -840,8 +754,7 @@ NET_Shutdown
|
||||
====================
|
||||
*/
|
||||
|
||||
void NET_Shutdown (void)
|
||||
{
|
||||
void NET_Shutdown(void) {
|
||||
qsocket_t *sock;
|
||||
|
||||
SetNetTime();
|
||||
@@ -849,14 +762,12 @@ void NET_Shutdown (void)
|
||||
for (sock = net_activeSockets; sock; sock = sock->next)
|
||||
NET_Close(sock);
|
||||
|
||||
//
|
||||
// shutdown the drivers
|
||||
//
|
||||
for (net_driverlevel = 0; net_driverlevel < net_numdrivers; net_driverlevel++)
|
||||
{
|
||||
if (net_drivers[net_driverlevel].initialized == true)
|
||||
{
|
||||
net_drivers[net_driverlevel].Shutdown ();
|
||||
//
|
||||
// shutdown the drivers
|
||||
//
|
||||
for (net_driverlevel = 0; net_driverlevel < net_numdrivers; net_driverlevel++) {
|
||||
if (net_drivers[net_driverlevel].initialized == true) {
|
||||
net_drivers[net_driverlevel].Shutdown();
|
||||
net_drivers[net_driverlevel].initialized = false;
|
||||
}
|
||||
}
|
||||
@@ -865,14 +776,12 @@ void NET_Shutdown (void)
|
||||
|
||||
static PollProcedure *pollProcedureList = NULL;
|
||||
|
||||
void NET_Poll(void)
|
||||
{
|
||||
void NET_Poll(void) {
|
||||
PollProcedure *pp;
|
||||
|
||||
SetNetTime();
|
||||
|
||||
for (pp = pollProcedureList; pp; pp = pp->next)
|
||||
{
|
||||
for (pp = pollProcedureList; pp; pp = pp->next) {
|
||||
if (pp->nextTime > net_time)
|
||||
break;
|
||||
pollProcedureList = pp->next;
|
||||
@@ -881,20 +790,17 @@ void NET_Poll(void)
|
||||
}
|
||||
|
||||
|
||||
void SchedulePollProcedure(PollProcedure *proc, double timeOffset)
|
||||
{
|
||||
void SchedulePollProcedure(PollProcedure *proc, double timeOffset) {
|
||||
PollProcedure *pp, *prev;
|
||||
|
||||
proc->nextTime = Sys_DoubleTime() + timeOffset;
|
||||
for (pp = pollProcedureList, prev = NULL; pp; pp = pp->next)
|
||||
{
|
||||
for (pp = pollProcedureList, prev = NULL; pp; pp = pp->next) {
|
||||
if (pp->nextTime >= proc->nextTime)
|
||||
break;
|
||||
prev = pp;
|
||||
}
|
||||
|
||||
if (prev == NULL)
|
||||
{
|
||||
if (prev == NULL) {
|
||||
proc->next = pollProcedureList;
|
||||
pollProcedureList = proc;
|
||||
return;
|
||||
@@ -903,4 +809,3 @@ void SchedulePollProcedure(PollProcedure *proc, double timeOffset)
|
||||
proc->next = pp;
|
||||
prev->next = proc;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -80,7 +80,7 @@ char *PL_GetClipboardData (void)
|
||||
* such as an ip address, etc: do chop the size
|
||||
* here, otherwise we may experience Z_Malloc()
|
||||
* failures and all other not-oh-so-fun stuff. */
|
||||
size = q_min((size_t)(MAX_CLIPBOARDTXT), size);
|
||||
size = std::min((size_t)(MAX_CLIPBOARDTXT), size);
|
||||
data = (char *) Z_Malloc((int)size);
|
||||
q_strlcpy (data, cliptext, size);
|
||||
}
|
||||
|
||||
+1
-1
@@ -67,7 +67,7 @@ char *PL_GetClipboardData (void)
|
||||
if (srcdata != NULL)
|
||||
{
|
||||
size_t sz = [clipboardString length] + 1;
|
||||
sz = q_min((size_t)(MAX_CLIPBOARDTXT), sz);
|
||||
sz = std::min((size_t)(MAX_CLIPBOARDTXT), sz);
|
||||
data = (char *) Z_Malloc((int)sz);
|
||||
q_strlcpy (data, srcdata, sz);
|
||||
}
|
||||
|
||||
+1
-1
@@ -95,7 +95,7 @@ char *PL_GetClipboardData (void)
|
||||
* such as an ip address, etc: do chop the size
|
||||
* here, otherwise we may experience Z_Malloc()
|
||||
* failures and all other not-oh-so-fun stuff. */
|
||||
size = q_min((size_t)(MAX_CLIPBOARDTXT), size);
|
||||
size = std::min((size_t)(MAX_CLIPBOARDTXT), size);
|
||||
data = (char *) Z_Malloc((int)size);
|
||||
q_strlcpy (data, cliptext, size);
|
||||
GlobalUnlock (hClipboardData);
|
||||
|
||||
+3
-3
@@ -930,7 +930,7 @@ static void PF_cvar (void)
|
||||
|
||||
str = G_STRING(OFS_PARM0);
|
||||
|
||||
G_FLOAT(OFS_RETURN) = Cvar_VariableValue (str);
|
||||
G_FLOAT(OFS_RETURN) = convar::variable_value(str).value_or(0.0);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -947,7 +947,7 @@ static void PF_cvar_set (void)
|
||||
var = G_STRING(OFS_PARM0);
|
||||
val = G_STRING(OFS_PARM1);
|
||||
|
||||
Cvar_Set (var, val);
|
||||
convar::set (var, val);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1378,7 +1378,7 @@ Pick a vector for the player to shoot along
|
||||
vector aim(entity, missilespeed)
|
||||
=============
|
||||
*/
|
||||
cvar_t sv_aim = {"sv_aim", "1", CVAR_NONE}; // ericw -- turn autoaim off by default. was 0.93
|
||||
convar sv_aim{"sv_aim", "1"}; // ericw -- turn autoaim off by default. was 0.93
|
||||
static void PF_aim (void)
|
||||
{
|
||||
edict_t *ent, *check, *bestent;
|
||||
|
||||
+84
-77
@@ -21,6 +21,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
// sv_edict.c -- entity dictionary
|
||||
|
||||
#include <sstream>
|
||||
|
||||
#include "quakedef.hpp"
|
||||
|
||||
dprograms_t *progs;
|
||||
@@ -72,17 +74,17 @@ static gefv_cache gefvCache[GEFV_CACHESIZE] =
|
||||
{ NULL, "" }
|
||||
};
|
||||
|
||||
cvar_t nomonsters = {"nomonsters", "0", CVAR_NONE};
|
||||
cvar_t gamecfg = {"gamecfg", "0", CVAR_NONE};
|
||||
cvar_t scratch1 = {"scratch1", "0", CVAR_NONE};
|
||||
cvar_t scratch2 = {"scratch2", "0", CVAR_NONE};
|
||||
cvar_t scratch3 = {"scratch3", "0", CVAR_NONE};
|
||||
cvar_t scratch4 = {"scratch4", "0", CVAR_NONE};
|
||||
cvar_t savedgamecfg = {"savedgamecfg", "0", CVAR_ARCHIVE};
|
||||
cvar_t saved1 = {"saved1", "0", CVAR_ARCHIVE};
|
||||
cvar_t saved2 = {"saved2", "0", CVAR_ARCHIVE};
|
||||
cvar_t saved3 = {"saved3", "0", CVAR_ARCHIVE};
|
||||
cvar_t saved4 = {"saved4", "0", CVAR_ARCHIVE};
|
||||
convar nomonsters{"nomonsters", "0"};
|
||||
convar gamecfg{"gamecfg", "0"};
|
||||
convar scratch1{"scratch1", "0"};
|
||||
convar scratch2{"scratch2", "0"};
|
||||
convar scratch3{"scratch3", "0"};
|
||||
convar scratch4{"scratch4", "0"};
|
||||
convar savedgamecfg{"savedgamecfg", "0", {.archive = true}};
|
||||
convar saved1{"saved1", "0", {.archive = true}};
|
||||
convar saved2{"saved2", "0", {.archive = true}};
|
||||
convar saved3{"saved3", "0", {.archive = true}};
|
||||
convar saved4{"saved4", "0", {.archive = true}};
|
||||
|
||||
/*
|
||||
=================
|
||||
@@ -619,7 +621,7 @@ static void ED_PrintEdict_f (void)
|
||||
if (!sv.active)
|
||||
return;
|
||||
|
||||
i = Q_atoi (Cmd_Argv(1));
|
||||
i = Q_atoi (command::argv(1).value_or("").c_str());
|
||||
if (i < 0 || i >= sv.num_edicts)
|
||||
{
|
||||
Con_Printf("Bad edict number\n");
|
||||
@@ -711,41 +713,43 @@ void ED_WriteGlobals (FILE *f)
|
||||
ED_ParseGlobals
|
||||
=============
|
||||
*/
|
||||
const char *ED_ParseGlobals (const char *data)
|
||||
void ED_ParseGlobals (std::istringstream &ss)
|
||||
{
|
||||
char keyname[64];
|
||||
ddef_t *key;
|
||||
|
||||
while (1)
|
||||
std::string keyname;
|
||||
|
||||
while (true)
|
||||
{
|
||||
// parse key
|
||||
data = COM_Parse (data);
|
||||
if (com_token[0] == '}')
|
||||
auto token = common::parse_token(ss);
|
||||
if (token.has_value() && token->front() == '}') {
|
||||
break;
|
||||
if (!data)
|
||||
}
|
||||
if (ss.eof()) {
|
||||
Host_Error ("ED_ParseEntity: EOF without closing brace");
|
||||
}
|
||||
|
||||
q_strlcpy (keyname, com_token, sizeof(keyname));
|
||||
keyname = token.value();
|
||||
|
||||
// parse value
|
||||
data = COM_Parse (data);
|
||||
if (!data)
|
||||
token = common::parse_token(ss);
|
||||
if (ss.eof())
|
||||
Host_Error ("ED_ParseEntity: EOF without closing brace");
|
||||
|
||||
if (com_token[0] == '}')
|
||||
if (token->front() == '}')
|
||||
Host_Error ("ED_ParseEntity: closing brace without data");
|
||||
|
||||
key = ED_FindGlobal (keyname);
|
||||
key = ED_FindGlobal (keyname.c_str());
|
||||
if (!key)
|
||||
{
|
||||
Con_Printf ("'%s' is not a global\n", keyname);
|
||||
Con_Printf ("'%s' is not a global\n", keyname.c_str());
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!ED_ParseEpair ((void *)pr_globals, key, com_token))
|
||||
if (!ED_ParseEpair ((void *)pr_globals, key, token->c_str()))
|
||||
Host_Error ("ED_ParseGlobals: parse error");
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
@@ -879,13 +883,14 @@ ed should be a properly initialized empty edict.
|
||||
Used for initial level load and for savegames.
|
||||
====================
|
||||
*/
|
||||
const char *ED_ParseEdict (const char *data, edict_t *ent)
|
||||
void ED_ParseEdict(std::istringstream &ss, edict_t *ent)
|
||||
{
|
||||
ddef_t *key;
|
||||
char keyname[256];
|
||||
qboolean anglehack, init;
|
||||
int n;
|
||||
|
||||
std::string keyname{};
|
||||
|
||||
init = false;
|
||||
|
||||
// clear it
|
||||
@@ -896,83 +901,82 @@ const char *ED_ParseEdict (const char *data, edict_t *ent)
|
||||
while (1)
|
||||
{
|
||||
// parse key
|
||||
data = COM_Parse (data);
|
||||
if (com_token[0] == '}')
|
||||
auto token = common::parse_token(ss);
|
||||
if (token.has_value() && token->front() == '}') {
|
||||
break;
|
||||
if (!data)
|
||||
}
|
||||
if (ss.eof()) {
|
||||
Host_Error ("ED_ParseEntity: EOF without closing brace");
|
||||
}
|
||||
|
||||
// anglehack is to allow QuakeEd to write single scalar angles
|
||||
// and allow them to be turned into vectors. (FIXME...)
|
||||
if (!strcmp(com_token, "angle"))
|
||||
if (token == "angle")
|
||||
{
|
||||
strcpy (com_token, "angles");
|
||||
token = "angles";
|
||||
anglehack = true;
|
||||
}
|
||||
else
|
||||
anglehack = false;
|
||||
|
||||
// FIXME: change light to _light to get rid of this hack
|
||||
if (!strcmp(com_token, "light"))
|
||||
strcpy (com_token, "light_lev"); // hack for single light def
|
||||
if (token == "light") {
|
||||
token = "light_lev";
|
||||
}
|
||||
|
||||
q_strlcpy (keyname, com_token, sizeof(keyname));
|
||||
keyname = *token;
|
||||
|
||||
// another hack to fix keynames with trailing spaces
|
||||
n = strlen(keyname);
|
||||
while (n && keyname[n-1] == ' ')
|
||||
{
|
||||
keyname[n-1] = 0;
|
||||
n--;
|
||||
while (!keyname.empty() && keyname.back() == ' ') {
|
||||
keyname.pop_back();
|
||||
}
|
||||
|
||||
// parse value
|
||||
// HACK: we allow truncation when reading the wad field,
|
||||
// otherwise maps using lots of wads with absolute paths
|
||||
// could cause a parse error
|
||||
data = COM_ParseEx (data, !strcmp (keyname, "wad") ? CPE_ALLOWTRUNC : CPE_NOTRUNC);
|
||||
if (!data)
|
||||
token = common::parse_token(ss);
|
||||
if (ss.eof()) {
|
||||
Host_Error ("ED_ParseEntity: EOF without closing brace");
|
||||
}
|
||||
|
||||
if (com_token[0] == '}')
|
||||
if (token->front() == '}') {
|
||||
Host_Error ("ED_ParseEntity: closing brace without data");
|
||||
}
|
||||
|
||||
init = true;
|
||||
|
||||
// keynames with a leading underscore are used for utility comments,
|
||||
// and are immediately discarded by quake
|
||||
if (keyname[0] == '_')
|
||||
if (keyname[0] == '_') {
|
||||
continue;
|
||||
}
|
||||
|
||||
//johnfitz -- hack to support .alpha even when progs.dat doesn't know about it
|
||||
if (!strcmp(keyname, "alpha"))
|
||||
ent->alpha = ENTALPHA_ENCODE(Q_atof(com_token));
|
||||
if (keyname == "alpha")
|
||||
ent->alpha = ENTALPHA_ENCODE(Q_atof(token->c_str()));
|
||||
//johnfitz
|
||||
|
||||
key = ED_FindField (keyname);
|
||||
key = ED_FindField (keyname.c_str());
|
||||
if (!key)
|
||||
{
|
||||
//johnfitz -- HACK -- suppress error becuase fog/sky/alpha fields might not be mentioned in defs.qc
|
||||
if (strncmp(keyname, "sky", 3) && strcmp(keyname, "fog") && strcmp(keyname, "alpha"))
|
||||
Con_DPrintf ("\"%s\" is not a field\n", keyname); //johnfitz -- was Con_Printf
|
||||
if (keyname != "sky" && keyname != "fog" && keyname != "alpha")
|
||||
Con_DPrintf ("\"%s\" is not a field\n", keyname.c_str()); //johnfitz -- was Con_Printf
|
||||
continue;
|
||||
}
|
||||
|
||||
if (anglehack)
|
||||
{
|
||||
char temp[32];
|
||||
strcpy (temp, com_token);
|
||||
sprintf (com_token, "0 %s 0", temp);
|
||||
token = std::format("0 {} 0", *token);
|
||||
}
|
||||
|
||||
if (!ED_ParseEpair ((void *)&ent->v, key, com_token))
|
||||
if (!ED_ParseEpair ((void *)&ent->v, key, token->c_str()))
|
||||
Host_Error ("ED_ParseEdict: parse error");
|
||||
}
|
||||
|
||||
if (!init)
|
||||
ent->free = true;
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
@@ -999,21 +1003,24 @@ void ED_LoadFromFile (const char *data)
|
||||
|
||||
pr_global_struct->time = sv.time;
|
||||
|
||||
std::istringstream ss{data};
|
||||
|
||||
|
||||
// parse ents
|
||||
while (1)
|
||||
while (true)
|
||||
{
|
||||
// parse the opening brace
|
||||
data = COM_Parse (data);
|
||||
if (!data)
|
||||
auto token = common::parse_token(ss);
|
||||
if (ss.eof())
|
||||
break;
|
||||
if (com_token[0] != '{')
|
||||
Host_Error ("ED_LoadFromFile: found %s when expecting {",com_token);
|
||||
if (token->front() != '{')
|
||||
Host_Error ("ED_LoadFromFile: found %s when expecting {", token->c_str());
|
||||
|
||||
if (!ent)
|
||||
ent = EDICT_NUM(0);
|
||||
else
|
||||
ent = ED_Alloc ();
|
||||
data = ED_ParseEdict (data, ent);
|
||||
ED_ParseEdict (ss, ent);
|
||||
|
||||
// remove things from different skill levels or deathmatch
|
||||
if (deathmatch.value)
|
||||
@@ -1270,21 +1277,21 @@ PR_Init
|
||||
*/
|
||||
void PR_Init (void)
|
||||
{
|
||||
Cmd_AddCommand ("edict", ED_PrintEdict_f);
|
||||
Cmd_AddCommand ("edicts", ED_PrintEdicts);
|
||||
Cmd_AddCommand ("edictcount", ED_Count);
|
||||
Cmd_AddCommand ("profile", PR_Profile_f);
|
||||
Cvar_RegisterVariable (&nomonsters);
|
||||
Cvar_RegisterVariable (&gamecfg);
|
||||
Cvar_RegisterVariable (&scratch1);
|
||||
Cvar_RegisterVariable (&scratch2);
|
||||
Cvar_RegisterVariable (&scratch3);
|
||||
Cvar_RegisterVariable (&scratch4);
|
||||
Cvar_RegisterVariable (&savedgamecfg);
|
||||
Cvar_RegisterVariable (&saved1);
|
||||
Cvar_RegisterVariable (&saved2);
|
||||
Cvar_RegisterVariable (&saved3);
|
||||
Cvar_RegisterVariable (&saved4);
|
||||
command::add("edict", ED_PrintEdict_f);
|
||||
command::add("edicts", ED_PrintEdicts);
|
||||
command::add("edictcount", ED_Count);
|
||||
command::add("profile", PR_Profile_f);
|
||||
nomonsters.inscribe();
|
||||
gamecfg.inscribe();
|
||||
scratch1.inscribe();
|
||||
scratch2.inscribe();
|
||||
scratch3.inscribe();
|
||||
scratch4.inscribe();
|
||||
savedgamecfg.inscribe();
|
||||
saved1.inscribe();
|
||||
saved2.inscribe();
|
||||
saved3.inscribe();
|
||||
saved4.inscribe();
|
||||
}
|
||||
|
||||
|
||||
|
||||
+3
-2
@@ -87,10 +87,11 @@ void ED_Free (edict_t *ed);
|
||||
|
||||
void ED_Print (edict_t *ed);
|
||||
void ED_Write (FILE *f, edict_t *ed);
|
||||
const char *ED_ParseEdict (const char *data, edict_t *ent);
|
||||
|
||||
void ED_ParseEdict(std::istringstream &ss, edict_t *ent);
|
||||
|
||||
void ED_WriteGlobals (FILE *f);
|
||||
const char *ED_ParseGlobals (const char *data);
|
||||
void ED_ParseGlobals (std::istringstream &ss);
|
||||
|
||||
void ED_LoadFromFile (const char *data);
|
||||
|
||||
|
||||
+6
-6
@@ -168,16 +168,16 @@ extern vec3_t listener_forward;
|
||||
extern vec3_t listener_right;
|
||||
extern vec3_t listener_up;
|
||||
|
||||
extern cvar_t sndspeed;
|
||||
extern cvar_t snd_mixspeed;
|
||||
extern cvar_t snd_filterquality;
|
||||
extern cvar_t sfxvolume;
|
||||
extern cvar_t loadas8bit;
|
||||
extern convar sndspeed;
|
||||
extern convar snd_mixspeed;
|
||||
extern convar snd_filterquality;
|
||||
extern convar sfxvolume;
|
||||
extern convar loadas8bit;
|
||||
|
||||
#define MAX_RAW_SAMPLES 8192
|
||||
extern portable_samplepair_t s_rawsamples[MAX_RAW_SAMPLES];
|
||||
|
||||
extern cvar_t bgmvolume;
|
||||
extern convar bgmvolume;
|
||||
|
||||
void S_LocalSound (const char *name);
|
||||
sfxcache_t *S_LoadSound (sfx_t *s);
|
||||
|
||||
+8
-8
@@ -75,15 +75,15 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define Q_MAXCHAR ((char)0x7f)
|
||||
#define Q_MAXSHORT ((short)0x7fff)
|
||||
#define Q_MAXINT ((int)0x7fffffff)
|
||||
#define Q_MAXLONG ((int)0x7fffffff)
|
||||
#define q_maxCHAR ((char)0x7f)
|
||||
#define q_maxSHORT ((short)0x7fff)
|
||||
#define q_maxINT ((int)0x7fffffff)
|
||||
#define q_maxLONG ((int)0x7fffffff)
|
||||
|
||||
#define Q_MINCHAR ((char)0x80)
|
||||
#define Q_MINSHORT ((short)0x8000)
|
||||
#define Q_MININT ((int)0x80000000)
|
||||
#define Q_MINLONG ((int)0x80000000)
|
||||
#define q_minCHAR ((char)0x80)
|
||||
#define q_minSHORT ((short)0x8000)
|
||||
#define q_minINT ((int)0x80000000)
|
||||
#define q_minLONG ((int)0x80000000)
|
||||
|
||||
#ifndef COMPILE_TIME_ASSERT
|
||||
#if defined(__cplusplus)
|
||||
|
||||
+7
-7
@@ -211,7 +211,7 @@ typedef struct
|
||||
#include "sys.hpp"
|
||||
#include "zone.hpp"
|
||||
#include "mathlib.hpp"
|
||||
#include "cvar.hpp"
|
||||
#include "convar.hpp"
|
||||
|
||||
#include "protocol.hpp"
|
||||
#include "net.hpp"
|
||||
@@ -275,11 +275,11 @@ extern qboolean noclip_anglehack;
|
||||
//
|
||||
extern quakeparms_t *host_parms;
|
||||
|
||||
extern cvar_t sys_ticrate;
|
||||
extern cvar_t sys_throttle;
|
||||
extern cvar_t sys_nostdout;
|
||||
extern cvar_t developer;
|
||||
extern cvar_t max_edicts; //johnfitz
|
||||
extern convar sys_ticrate;
|
||||
extern convar sys_throttle;
|
||||
extern convar sys_nostdout;
|
||||
extern convar developer;
|
||||
extern convar max_edicts; //johnfitz
|
||||
|
||||
extern qboolean host_initialized; // true if into command execution
|
||||
extern double host_frametime;
|
||||
@@ -303,7 +303,7 @@ void Host_ServerFrame (void);
|
||||
void Host_InitCommands (void);
|
||||
void Host_Init (void);
|
||||
void Host_Shutdown(void);
|
||||
void Host_Callback_Notify (cvar_t *var); /* callback function for CVAR_NOTIFY */
|
||||
void Host_Callback_Notify (convar *var); /* callback function for CVAR_NOTIFY */
|
||||
FUNC_NORETURN void Host_Error (const char *error, ...) FUNC_PRINTF(1,2);
|
||||
FUNC_NORETURN void Host_EndGame (const char *message, ...) FUNC_PRINTF(1,2);
|
||||
#ifdef __WATCOMC__
|
||||
|
||||
+2
-2
@@ -24,8 +24,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#include "quakedef.hpp"
|
||||
|
||||
extern cvar_t r_drawflat, gl_overbright_models, gl_fullbrights, r_lerpmodels, r_lerpmove; //johnfitz
|
||||
extern cvar_t scr_fov, cl_gun_fovscale;
|
||||
extern convar r_drawflat, gl_overbright_models, gl_fullbrights, r_lerpmodels, r_lerpmove; //johnfitz
|
||||
extern convar scr_fov, cl_gun_fovscale;
|
||||
|
||||
//up to 16 color translated skins
|
||||
gltexture_t *playertextures[MAX_SCOREBOARD]; //johnfitz -- changed to an array of pointers
|
||||
|
||||
+2
-2
@@ -24,8 +24,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#include "quakedef.hpp"
|
||||
|
||||
extern cvar_t gl_fullbrights, r_drawflat, gl_overbright, r_oldwater; //johnfitz
|
||||
extern cvar_t gl_zfix; // QuakeSpasm z-fighting fix
|
||||
extern convar gl_fullbrights, r_drawflat, gl_overbright, r_oldwater; //johnfitz
|
||||
extern convar gl_zfix; // QuakeSpasm z-fighting fix
|
||||
|
||||
int gl_lightmap_format;
|
||||
int lightmap_bytes;
|
||||
|
||||
+10
-10
@@ -39,8 +39,8 @@ static int r_numparticles;
|
||||
static gltexture_t *particletexture, *particletexture1, *particletexture2, *particletexture3; //johnfitz
|
||||
static float texturescalefactor; //johnfitz -- compensate for apparent size of different particle textures
|
||||
|
||||
cvar_t r_particles = {"r_particles","1", CVAR_ARCHIVE}; //johnfitz
|
||||
cvar_t r_quadparticles = {"r_quadparticles","1", CVAR_ARCHIVE}; //johnfitz
|
||||
convar r_particles{"r_particles","1", {.archive = true}}; //johnfitz
|
||||
convar r_quadparticles{"r_quadparticles","1", {.archive = true}}; //johnfitz
|
||||
|
||||
/*
|
||||
===============
|
||||
@@ -57,7 +57,7 @@ int R_ParticleTextureLookup (int x, int y, int sharpness)
|
||||
r = x * x + y * y;
|
||||
r = r > 255 ? 255 : r;
|
||||
a = sharpness * (255 - r);
|
||||
a = q_min(a,255);
|
||||
a = std::min(a,255);
|
||||
return a;
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@ void R_InitParticleTextures (void)
|
||||
R_SetParticleTexture_f -- johnfitz
|
||||
===============
|
||||
*/
|
||||
static void R_SetParticleTexture_f (cvar_t *var)
|
||||
static void R_SetParticleTexture_f (convar *var)
|
||||
{
|
||||
switch ((int)(r_particles.value))
|
||||
{
|
||||
@@ -166,9 +166,9 @@ void R_InitParticles (void)
|
||||
particles = (particle_t *)
|
||||
Hunk_AllocName (r_numparticles * sizeof(particle_t), "particles");
|
||||
|
||||
Cvar_RegisterVariable (&r_particles); //johnfitz
|
||||
Cvar_SetCallback (&r_particles, R_SetParticleTexture_f);
|
||||
Cvar_RegisterVariable (&r_quadparticles); //johnfitz
|
||||
r_particles.inscribe(); //johnfitz
|
||||
r_particles.set_callback(R_SetParticleTexture_f);
|
||||
r_quadparticles.inscribe(); //johnfitz
|
||||
|
||||
R_InitParticleTextures (); //johnfitz
|
||||
}
|
||||
@@ -722,7 +722,7 @@ void CL_RunParticles (void)
|
||||
particle_t *p, *kill;
|
||||
int i;
|
||||
float time1, time2, time3, dvel, frametime, grav;
|
||||
extern cvar_t sv_gravity;
|
||||
extern convar sv_gravity;
|
||||
|
||||
frametime = cl.time - cl.oldtime;
|
||||
time3 = frametime * 15;
|
||||
@@ -829,7 +829,7 @@ void R_DrawParticles (void)
|
||||
float scale;
|
||||
vec3_t up, right, p_up, p_right, p_upright; //johnfitz -- p_ vectors
|
||||
GLubyte color[4], *c; //johnfitz -- particle transparency
|
||||
extern cvar_t r_particles; //johnfitz
|
||||
extern convar r_particles; //johnfitz
|
||||
//float alpha; //johnfitz -- particle transparency
|
||||
|
||||
if (!r_particles.value)
|
||||
@@ -949,7 +949,7 @@ void R_DrawParticles_ShowTris (void)
|
||||
particle_t *p;
|
||||
float scale;
|
||||
vec3_t up, right, p_up, p_right, p_upright;
|
||||
extern cvar_t r_particles;
|
||||
extern convar r_particles;
|
||||
|
||||
if (!r_particles.value)
|
||||
return;
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#include "quakedef.hpp"
|
||||
|
||||
extern cvar_t gl_fullbrights, r_drawflat, gl_overbright, r_oldwater, r_oldskyleaf, r_showtris; //johnfitz
|
||||
extern convar gl_fullbrights, r_drawflat, gl_overbright, r_oldwater, r_oldskyleaf, r_showtris; //johnfitz
|
||||
|
||||
byte *SV_FatPVS (vec3_t org, qmodel_t *worldmodel);
|
||||
|
||||
|
||||
+8
-8
@@ -253,8 +253,8 @@ Sbar_Init -- johnfitz -- rewritten
|
||||
*/
|
||||
void Sbar_Init (void)
|
||||
{
|
||||
Cmd_AddCommand ("+showscores", Sbar_ShowScores);
|
||||
Cmd_AddCommand ("-showscores", Sbar_DontShowScores);
|
||||
command::add ("+showscores", Sbar_ShowScores);
|
||||
command::add ("-showscores", Sbar_DontShowScores);
|
||||
|
||||
Sbar_LoadPics ();
|
||||
}
|
||||
@@ -388,7 +388,7 @@ void Sbar_DrawNum (int x, int y, int num, int digits, int color)
|
||||
char *ptr;
|
||||
int l, frame;
|
||||
|
||||
num = q_min(999,num); //johnfitz -- cap high values rather than truncating number
|
||||
num = std::min(999,num); //johnfitz -- cap high values rather than truncating number
|
||||
|
||||
l = Sbar_itoa (num, str);
|
||||
ptr = str;
|
||||
@@ -640,7 +640,7 @@ void Sbar_DrawInventory (void)
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
val = cl.stats[STAT_SHELLS+i];
|
||||
val = (val < 0)? 0 : q_min(999,val);//johnfitz -- cap displayed value to 999
|
||||
val = (val < 0)? 0 : std::min(999,val);//johnfitz -- cap displayed value to 999
|
||||
sprintf (num, "%3i", val);
|
||||
if (num[0] != ' ')
|
||||
Sbar_DrawCharacter ( (6*i+1)*8 + 2, -24, 18 + num[0] - '0');
|
||||
@@ -754,7 +754,7 @@ void Sbar_DrawFrags (void)
|
||||
Sbar_SortFrags ();
|
||||
|
||||
// draw the text
|
||||
numscores = q_min(scoreboardlines, 4);
|
||||
numscores = std::min(scoreboardlines, 4);
|
||||
|
||||
for (i = 0, x = 184; i<numscores; i++, x += 32)
|
||||
{
|
||||
@@ -1302,12 +1302,12 @@ void Sbar_IntermissionOverlay (void)
|
||||
lsecrets = Sbar_IntermissionTextWidth (secrets, 0);
|
||||
lmonsters = Sbar_IntermissionTextWidth (monsters, 0);
|
||||
|
||||
total = q_max (ltime, lsecrets);
|
||||
total = q_max (lmonsters, total);
|
||||
total = std::max (ltime, lsecrets);
|
||||
total = std::max (lmonsters, total);
|
||||
|
||||
pic = Draw_CachePic ("gfx/inter.lmp");
|
||||
total += pic->width + 24;
|
||||
total = q_min (320, total);
|
||||
total = std::min (320, total);
|
||||
Draw_Pic (160 - total / 2, 56, pic);
|
||||
|
||||
pic = Draw_CachePic ("gfx/complete.lmp");
|
||||
|
||||
+8
-8
@@ -50,9 +50,9 @@ extern int clearnotify; // set to 0 whenever notify text is drawn
|
||||
extern qboolean scr_disabled_for_loading;
|
||||
extern qboolean scr_skipupdate;
|
||||
|
||||
extern cvar_t scr_viewsize;
|
||||
extern convar scr_viewsize;
|
||||
|
||||
extern cvar_t scr_sbaralpha; //johnfitz
|
||||
extern convar scr_sbaralpha; //johnfitz
|
||||
|
||||
void SCR_UpdateWholeScreen (void);
|
||||
|
||||
@@ -70,12 +70,12 @@ typedef enum {
|
||||
CANVAS_TOPRIGHT,
|
||||
CANVAS_INVALID = -1
|
||||
} canvastype;
|
||||
extern cvar_t scr_menuscale;
|
||||
extern cvar_t scr_sbarscale;
|
||||
extern cvar_t scr_conwidth;
|
||||
extern cvar_t scr_conscale;
|
||||
extern cvar_t scr_scale;
|
||||
extern cvar_t scr_crosshairscale;
|
||||
extern convar scr_menuscale;
|
||||
extern convar scr_sbarscale;
|
||||
extern convar scr_conwidth;
|
||||
extern convar scr_conscale;
|
||||
extern convar scr_scale;
|
||||
extern convar scr_crosshairscale;
|
||||
//johnfitz
|
||||
|
||||
extern int scr_tileclear_updates; //johnfitz
|
||||
|
||||
+6
-6
@@ -189,12 +189,12 @@ typedef struct client_s
|
||||
|
||||
//============================================================================
|
||||
|
||||
extern cvar_t teamplay;
|
||||
extern cvar_t skill;
|
||||
extern cvar_t deathmatch;
|
||||
extern cvar_t coop;
|
||||
extern cvar_t fraglimit;
|
||||
extern cvar_t timelimit;
|
||||
extern convar teamplay;
|
||||
extern convar skill;
|
||||
extern convar deathmatch;
|
||||
extern convar coop;
|
||||
extern convar fraglimit;
|
||||
extern convar timelimit;
|
||||
|
||||
extern server_static_t svs; // persistant server info
|
||||
extern server_t sv; // local server
|
||||
|
||||
+232
-320
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -183,7 +183,7 @@ static int mp3_decode(snd_stream_t *stream, byte *buf, int len)
|
||||
do
|
||||
{
|
||||
x = (p->Synth.pcm.length - p->cursamp) * stream->info.channels;
|
||||
donow = q_min(len, x);
|
||||
donow = std::min(len, x);
|
||||
i = 0;
|
||||
while (i < donow)
|
||||
{
|
||||
|
||||
+35
-35
@@ -44,13 +44,13 @@ void SV_Protocol_f (void)
|
||||
{
|
||||
int i;
|
||||
|
||||
switch (Cmd_Argc())
|
||||
switch (command::argc())
|
||||
{
|
||||
case 1:
|
||||
Con_Printf ("\"sv_protocol\" is \"%i\"\n", sv_protocol);
|
||||
break;
|
||||
case 2:
|
||||
i = atoi(Cmd_Argv(1));
|
||||
i = atoi(command::argv(1)->c_str());
|
||||
if (i != PROTOCOL_NETQUAKE && i != PROTOCOL_FITZQUAKE && i != PROTOCOL_RMQ)
|
||||
Con_Printf ("sv_protocol must be %i or %i or %i\n", PROTOCOL_NETQUAKE, PROTOCOL_FITZQUAKE, PROTOCOL_RMQ);
|
||||
else
|
||||
@@ -75,38 +75,38 @@ void SV_Init (void)
|
||||
{
|
||||
int i;
|
||||
const char *p;
|
||||
extern cvar_t sv_maxvelocity;
|
||||
extern cvar_t sv_gravity;
|
||||
extern cvar_t sv_nostep;
|
||||
extern cvar_t sv_freezenonclients;
|
||||
extern cvar_t sv_friction;
|
||||
extern cvar_t sv_edgefriction;
|
||||
extern cvar_t sv_stopspeed;
|
||||
extern cvar_t sv_maxspeed;
|
||||
extern cvar_t sv_accelerate;
|
||||
extern cvar_t sv_idealpitchscale;
|
||||
extern cvar_t sv_aim;
|
||||
extern cvar_t sv_altnoclip; //johnfitz
|
||||
extern convar sv_maxvelocity;
|
||||
extern convar sv_gravity;
|
||||
extern convar sv_nostep;
|
||||
extern convar sv_freezenonclients;
|
||||
extern convar sv_friction;
|
||||
extern convar sv_edgefriction;
|
||||
extern convar sv_stopspeed;
|
||||
extern convar sv_maxspeed;
|
||||
extern convar sv_accelerate;
|
||||
extern convar sv_idealpitchscale;
|
||||
extern convar sv_aim;
|
||||
extern convar sv_altnoclip; //johnfitz
|
||||
|
||||
sv.edicts = NULL; // ericw -- sv.edicts switched to use malloc()
|
||||
|
||||
Cvar_RegisterVariable (&sv_maxvelocity);
|
||||
Cvar_RegisterVariable (&sv_gravity);
|
||||
Cvar_RegisterVariable (&sv_friction);
|
||||
Cvar_SetCallback (&sv_gravity, Host_Callback_Notify);
|
||||
Cvar_SetCallback (&sv_friction, Host_Callback_Notify);
|
||||
Cvar_RegisterVariable (&sv_edgefriction);
|
||||
Cvar_RegisterVariable (&sv_stopspeed);
|
||||
Cvar_RegisterVariable (&sv_maxspeed);
|
||||
Cvar_SetCallback (&sv_maxspeed, Host_Callback_Notify);
|
||||
Cvar_RegisterVariable (&sv_accelerate);
|
||||
Cvar_RegisterVariable (&sv_idealpitchscale);
|
||||
Cvar_RegisterVariable (&sv_aim);
|
||||
Cvar_RegisterVariable (&sv_nostep);
|
||||
Cvar_RegisterVariable (&sv_freezenonclients);
|
||||
Cvar_RegisterVariable (&sv_altnoclip); //johnfitz
|
||||
sv_maxvelocity.inscribe();
|
||||
sv_gravity.inscribe();
|
||||
sv_friction.inscribe();
|
||||
sv_gravity.set_callback(Host_Callback_Notify);
|
||||
sv_friction.set_callback(Host_Callback_Notify);
|
||||
sv_edgefriction.inscribe();
|
||||
sv_stopspeed.inscribe();
|
||||
sv_maxspeed.inscribe();
|
||||
sv_maxspeed.set_callback(Host_Callback_Notify);
|
||||
sv_accelerate.inscribe();
|
||||
sv_idealpitchscale.inscribe();
|
||||
sv_aim.inscribe();
|
||||
sv_nostep.inscribe();
|
||||
sv_freezenonclients.inscribe();
|
||||
sv_altnoclip.inscribe(); //johnfitz
|
||||
|
||||
Cmd_AddCommand ("sv_protocol", &SV_Protocol_f); //johnfitz
|
||||
command::add ("sv_protocol", &SV_Protocol_f); //johnfitz
|
||||
|
||||
for (i=0 ; i<MAX_MODELS ; i++)
|
||||
sprintf (localmodels[i], "*%i", i);
|
||||
@@ -799,7 +799,7 @@ stats:
|
||||
if (msg->cursize > 1024 && dev_peakstats.packetsize <= 1024)
|
||||
Con_DWarning ("%i byte packet exceeds standard limit of 1024 (max = %d).\n", msg->cursize, msg->maxsize);
|
||||
dev_stats.packetsize = msg->cursize;
|
||||
dev_peakstats.packetsize = q_max(msg->cursize, dev_peakstats.packetsize);
|
||||
dev_peakstats.packetsize = std::max(msg->cursize, dev_peakstats.packetsize);
|
||||
//johnfitz
|
||||
}
|
||||
|
||||
@@ -1415,7 +1415,7 @@ void SV_SendReconnect (void)
|
||||
NET_SendToAll (&msg, 5.0);
|
||||
|
||||
if (!isDedicated)
|
||||
Cmd_ExecuteString ("reconnect\n", src_command);
|
||||
command::execute_string ("reconnect\n", command::source::command);
|
||||
}
|
||||
|
||||
|
||||
@@ -1463,7 +1463,7 @@ void SV_SpawnServer (const char *server)
|
||||
|
||||
// let's not have any servers with no name
|
||||
if (hostname.string[0] == 0)
|
||||
Cvar_Set ("hostname", "UNNAMED");
|
||||
convar::set ("hostname", "UNNAMED");
|
||||
scr_centertime_off = 0;
|
||||
|
||||
Con_DPrintf ("SpawnServer: %s\n",server);
|
||||
@@ -1481,14 +1481,14 @@ void SV_SpawnServer (const char *server)
|
||||
// make cvars consistant
|
||||
//
|
||||
if (coop.value)
|
||||
Cvar_Set ("deathmatch", "0");
|
||||
convar::set ("deathmatch", "0");
|
||||
current_skill = (int)(skill.value + 0.5);
|
||||
if (current_skill < 0)
|
||||
current_skill = 0;
|
||||
if (current_skill > 3)
|
||||
current_skill = 3;
|
||||
|
||||
Cvar_SetValue ("skill", (float)current_skill);
|
||||
convar::set_value ("skill", (float)current_skill);
|
||||
|
||||
//
|
||||
// set up the new server
|
||||
|
||||
+6
-6
@@ -41,12 +41,12 @@ solid_edge items only clip against bsp models.
|
||||
|
||||
*/
|
||||
|
||||
cvar_t sv_friction = {"sv_friction","4",CVAR_NOTIFY|CVAR_SERVERINFO};
|
||||
cvar_t sv_stopspeed = {"sv_stopspeed","100",CVAR_NONE};
|
||||
cvar_t sv_gravity = {"sv_gravity","800",CVAR_NOTIFY|CVAR_SERVERINFO};
|
||||
cvar_t sv_maxvelocity = {"sv_maxvelocity","2000",CVAR_NONE};
|
||||
cvar_t sv_nostep = {"sv_nostep","0",CVAR_NONE};
|
||||
cvar_t sv_freezenonclients = {"sv_freezenonclients","0",CVAR_NONE};
|
||||
convar sv_friction{"sv_friction","4", {.notify = true,. server_info = true}};
|
||||
convar sv_stopspeed{"sv_stopspeed","100"};
|
||||
convar sv_gravity{"sv_gravity","800",{.notify = true,. server_info = true}};
|
||||
convar sv_maxvelocity{"sv_maxvelocity","2000"};
|
||||
convar sv_nostep{"sv_nostep","0"};
|
||||
convar sv_freezenonclients{"sv_freezenonclients","0"};
|
||||
|
||||
|
||||
#define MOVE_EPSILON 0.01
|
||||
|
||||
+8
-8
@@ -25,9 +25,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
edict_t *sv_player;
|
||||
|
||||
extern cvar_t sv_friction;
|
||||
cvar_t sv_edgefriction = {"edgefriction", "2", CVAR_NONE};
|
||||
extern cvar_t sv_stopspeed;
|
||||
extern convar sv_friction;
|
||||
convar sv_edgefriction{"edgefriction", "2"};
|
||||
extern convar sv_stopspeed;
|
||||
|
||||
static vec3_t forward, right, up;
|
||||
|
||||
@@ -40,8 +40,8 @@ qboolean onground;
|
||||
|
||||
usercmd_t cmd;
|
||||
|
||||
cvar_t sv_idealpitchscale = {"sv_idealpitchscale","0.8",CVAR_NONE};
|
||||
cvar_t sv_altnoclip = {"sv_altnoclip","1",CVAR_ARCHIVE}; //johnfitz
|
||||
convar sv_idealpitchscale{"sv_idealpitchscale","0.8"};
|
||||
convar sv_altnoclip{"sv_altnoclip","1",{.archive = true}}; //johnfitz
|
||||
|
||||
/*
|
||||
===============
|
||||
@@ -163,8 +163,8 @@ void SV_UserFriction (void)
|
||||
SV_Accelerate
|
||||
==============
|
||||
*/
|
||||
cvar_t sv_maxspeed = {"sv_maxspeed", "320", CVAR_NOTIFY|CVAR_SERVERINFO};
|
||||
cvar_t sv_accelerate = {"sv_accelerate", "10", CVAR_NONE};
|
||||
convar sv_maxspeed{"sv_maxspeed", "320", {.notify = true,. server_info = true}};
|
||||
convar sv_accelerate{"sv_accelerate", "10"};
|
||||
void SV_Accelerate (float wishspeed, const vec3_t wishdir)
|
||||
{
|
||||
int i;
|
||||
@@ -570,7 +570,7 @@ nextmsg:
|
||||
ret = 1;
|
||||
|
||||
if (ret == 1)
|
||||
Cmd_ExecuteString (s, src_client);
|
||||
command::execute_string (s, command::source::client);
|
||||
else
|
||||
Con_DPrintf("%s tried to %s\n", host_client->name, s);
|
||||
break;
|
||||
|
||||
@@ -49,7 +49,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
|
||||
qboolean isDedicated;
|
||||
cvar_t sys_throttle = {"sys_throttle", "0.02", CVAR_ARCHIVE};
|
||||
convar sys_throttle = {"sys_throttle", "0.02", {.archive = true}};
|
||||
|
||||
#define MAX_HANDLES 32 /* johnfitz -- was 10 */
|
||||
static FILE *sys_handles[MAX_HANDLES];
|
||||
|
||||
+255
-319
File diff suppressed because it is too large
Load Diff
+2
-2
@@ -23,8 +23,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#ifndef _QUAKE_VIEW_H
|
||||
#define _QUAKE_VIEW_H
|
||||
|
||||
extern cvar_t vid_gamma;
|
||||
extern cvar_t vid_contrast;
|
||||
extern convar vid_gamma;
|
||||
extern convar vid_contrast;
|
||||
|
||||
extern float v_blend[4];
|
||||
|
||||
|
||||
+3
-3
@@ -238,7 +238,7 @@ void *Z_Realloc(void *ptr, int size)
|
||||
Sys_Error ("Z_Realloc: failed on allocation of %i bytes", size);
|
||||
|
||||
if (ptr != old_ptr)
|
||||
memmove (ptr, old_ptr, q_min(old_size, size));
|
||||
memmove (ptr, old_ptr, std::min(old_size, size));
|
||||
if (old_size < size)
|
||||
memset ((byte *)ptr + old_size, 0, size - old_size);
|
||||
|
||||
@@ -838,7 +838,7 @@ void Cache_Init (void)
|
||||
cache_head.next = cache_head.prev = &cache_head;
|
||||
cache_head.lru_next = cache_head.lru_prev = &cache_head;
|
||||
|
||||
Cmd_AddCommand ("flush", Cache_Flush);
|
||||
command::add ("flush", Cache_Flush);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -984,6 +984,6 @@ void Memory_Init (void *buf, int size)
|
||||
mainzone = (memzone_t *) Hunk_AllocName (zonesize, "zone" );
|
||||
Memory_InitZone (mainzone, zonesize);
|
||||
|
||||
Cmd_AddCommand ("hunk_print", Hunk_Print_f); //johnfitz
|
||||
command::add ("hunk_print", Hunk_Print_f); //johnfitz
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user