shithub: qk1

Download patch

ref: 0a04c0ef0e6f891e7b1342f862f4c8d5719e2cfa
parent: b64d816a6b39760ca8df9434d7277bf8babe55b3
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Sat Nov 25 21:46:08 EST 2023

DP_QC_SINCOSSQRTPOW

--- a/pr_cmds.c
+++ b/pr_cmds.c
@@ -1562,11 +1562,36 @@
 
 static const char *exts[] = {
 	"DP_EF_NODRAW",
+	"DP_QC_SINCOSSQRTPOW",
 	"DP_QC_TOKENIZE_CONSOLE", /* FIXME(sigrid): not really; see somewhere below */
 	"KRIMZON_SV_PARSECLIENTCOMMAND",
 };
 
 static void
+PF_sin(pr_t *pr)
+{
+	G_FLOAT(pr, OFS_RETURN) = sin(G_FLOAT(pr, OFS_PARM0));
+}
+
+static void
+PF_cos(pr_t *pr)
+{
+	G_FLOAT(pr, OFS_RETURN) = cos(G_FLOAT(pr, OFS_PARM0));
+}
+
+static void
+PF_sqrt(pr_t *pr)
+{
+	G_FLOAT(pr, OFS_RETURN) = sqrt(G_FLOAT(pr, OFS_PARM0));
+}
+
+static void
+PF_pow(pr_t *pr)
+{
+	G_FLOAT(pr, OFS_RETURN) = pow(G_FLOAT(pr, OFS_PARM0), G_FLOAT(pr, OFS_PARM1));
+}
+
+static void
 PF_checkextension(pr_t *pr)
 {
 	const char *ext = G_STRING(pr, OFS_PARM0);
@@ -1709,13 +1734,13 @@
 PF_WriteString,
 PF_WriteEntity,
 
+[60] = PF_sin,
+[61] = PF_cos,
+[62] = PF_sqrt,
 PF_Fixme,
 PF_Fixme,
 PF_Fixme,
 PF_Fixme,
-PF_Fixme,
-PF_Fixme,
-PF_Fixme,
 
 PF_MoveToGoal,
 PF_precache_file,
@@ -1735,6 +1760,7 @@
 
 PF_setspawnparms, // #78
 
+[97] = PF_pow,
 [99] = PF_checkextension,
 [232] = PF_clientstat,
 [440] = PF_clientcommand,