From: Rudolf Polzer Date: Fri, 8 Nov 2024 15:57:37 +0000 (-0500) Subject: Change other instruction names to match FTEQW. X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=55e56658cb6e7e68c8ed11da18eebd8241a58960;p=xonotic%2Fdarkplaces.git Change other instruction names to match FTEQW. Adds _F and _I type suffixes to lots of Quake-inherited opcodes that had no type suffix but used floats (or ints). Not handling IF/IFNOT yet, but documenting a plan. --- diff --git a/pr_comp.h b/pr_comp.h index 653faab8..5d91ceb8 100644 --- a/pr_comp.h +++ b/pr_comp.h @@ -67,10 +67,10 @@ typedef enum opcode_e OP_NE_E, OP_NE_FNC, - OP_LE, - OP_GE, - OP_LT, - OP_GT, + OP_LE_F, + OP_GE_F, + OP_LT_F, + OP_GT_F, OP_LOAD_F, OP_LOAD_V, @@ -114,14 +114,14 @@ typedef enum opcode_e OP_CALL8, OP_STATE, OP_GOTO, - OP_AND, - OP_OR, + OP_AND_F, + OP_OR_F, - OP_BITAND, - OP_BITOR, + OP_BITAND_F, + OP_BITOR_F, // TODO: actually support Hexen 2? - + OP_MULSTORE_F, //66 redundant, for h2 compat OP_MULSTORE_VF, //67 redundant, for h2 compat OP_MULSTOREP_F, //68 @@ -194,11 +194,11 @@ typedef enum opcode_e OP_SUB_FI, OP_SUB_IF, - OP_CONV_IF, - OP_CONV_FI, - - OP_LOADP_IF, - OP_LOADP_FI, + OP_CONV_ITOF, + OP_CONV_FTOI, + + OP_LOADP_ITOF, + OP_LOADP_FTOI, OP_LOAD_I, @@ -230,7 +230,7 @@ typedef enum opcode_e OP_ADD_PIW, OP_LOADA_F, - OP_LOADA_V, + OP_LOADA_V, OP_LOADA_S, OP_LOADA_ENT, OP_LOADA_FLD, @@ -241,7 +241,7 @@ typedef enum opcode_e OP_LOAD_P, OP_LOADP_F, - OP_LOADP_V, + OP_LOADP_V, OP_LOADP_S, OP_LOADP_ENT, OP_LOADP_FLD, @@ -252,7 +252,7 @@ typedef enum opcode_e OP_GE_I, OP_LT_I, OP_GT_I, - + OP_LE_IF, OP_GE_IF, OP_LT_IF, @@ -295,7 +295,7 @@ typedef enum opcode_e OP_GSTOREP_ENT, OP_GSTOREP_FLD, OP_GSTOREP_S, - OP_GSTOREP_FNC, + OP_GSTOREP_FNC, OP_GSTOREP_V, OP_GADDRESS, OP_GLOAD_I, diff --git a/prvm_edict.c b/prvm_edict.c index d3c29534..0bc9bbbd 100644 --- a/prvm_edict.c +++ b/prvm_edict.c @@ -2327,8 +2327,8 @@ void PRVM_Prog_Load(prvm_prog_t *prog, const char *filename, unsigned char *data case OP_SUB_I: case OP_SUB_FI: case OP_SUB_IF: - case OP_CONV_IF: - case OP_CONV_FI: + case OP_CONV_ITOF: + case OP_CONV_FTOI: case OP_LOAD_I: case OP_BITAND_I: case OP_BITOR_I: @@ -2394,14 +2394,14 @@ void PRVM_Prog_Load(prvm_prog_t *prog, const char *filename, unsigned char *data case OP_MUL_FV: case OP_MUL_VF: case OP_DIV_F: - case OP_BITAND: - case OP_BITOR: - case OP_GE: - case OP_LE: - case OP_GT: - case OP_LT: - case OP_AND: - case OP_OR: + case OP_BITAND_F: + case OP_BITOR_F: + case OP_GE_F: + case OP_LE_F: + case OP_GT_F: + case OP_LT_F: + case OP_AND_F: + case OP_OR_F: case OP_EQ_F: case OP_EQ_V: case OP_EQ_S: diff --git a/prvm_exec.c b/prvm_exec.c index a7ea3cc6..9bd38270 100644 --- a/prvm_exec.c +++ b/prvm_exec.c @@ -49,10 +49,10 @@ static const char *prvm_opnames[] = "^2NE_E", "^2NE_FNC", -"^2LE", -"^2GE", -"^2LT", -"^2GT", +"^2LE_F", +"^2GE_F", +"^2LT_F", +"^2GT_F", "^6LOAD_F", "^6LOAD_V", @@ -96,11 +96,11 @@ static const char *prvm_opnames[] = "^3CALL8", "^1STATE", "^5GOTO", -"^2AND", -"^2OR", +"^2AND_F", +"^2OR_F", -"BITAND", -"BITOR", +"BITAND_F", +"BITOR_F", @@ -176,8 +176,8 @@ NULL, "SUB_FI", "SUB_IF", -"CONV_IF", -"CONV_FI", +"CONV_ITOF", +"CONV_FTOI", NULL, NULL, diff --git a/prvm_execprogram.h b/prvm_execprogram.h index d303944e..c3e7ecfc 100644 --- a/prvm_execprogram.h +++ b/prvm_execprogram.h @@ -63,10 +63,10 @@ prvm_eval_t *src; &&handle_OP_NE_E, &&handle_OP_NE_FNC, - &&handle_OP_LE, - &&handle_OP_GE, - &&handle_OP_LT, - &&handle_OP_GT, + &&handle_OP_LE_F, + &&handle_OP_GE_F, + &&handle_OP_LT_F, + &&handle_OP_GT_F, &&handle_OP_LOAD_F, &&handle_OP_LOAD_V, @@ -110,11 +110,11 @@ prvm_eval_t *src; &&handle_OP_CALL8, &&handle_OP_STATE, &&handle_OP_GOTO, - &&handle_OP_AND, - &&handle_OP_OR, + &&handle_OP_AND_F, + &&handle_OP_OR_F, - &&handle_OP_BITAND, - &&handle_OP_BITOR, + &&handle_OP_BITAND_F, + &&handle_OP_BITOR_F, NULL, NULL, @@ -176,8 +176,8 @@ prvm_eval_t *src; &&handle_OP_SUB_I, &&handle_OP_SUB_FI, &&handle_OP_SUB_IF, - &&handle_OP_CONV_IF, - &&handle_OP_CONV_FI, + &&handle_OP_CONV_ITOF, + &&handle_OP_CONV_FTOI, NULL, NULL, @@ -385,28 +385,28 @@ prvm_eval_t *src; OPC->_float = 0.0f; } DISPATCH_OPCODE(); - HANDLE_OPCODE(OP_BITAND): + HANDLE_OPCODE(OP_BITAND_F): OPC->_float = (prvm_int_t)OPA->_float & (prvm_int_t)OPB->_float; DISPATCH_OPCODE(); - HANDLE_OPCODE(OP_BITOR): + HANDLE_OPCODE(OP_BITOR_F): OPC->_float = (prvm_int_t)OPA->_float | (prvm_int_t)OPB->_float; DISPATCH_OPCODE(); - HANDLE_OPCODE(OP_GE): + HANDLE_OPCODE(OP_GE_F): OPC->_float = OPA->_float >= OPB->_float; DISPATCH_OPCODE(); - HANDLE_OPCODE(OP_LE): + HANDLE_OPCODE(OP_LE_F): OPC->_float = OPA->_float <= OPB->_float; DISPATCH_OPCODE(); - HANDLE_OPCODE(OP_GT): + HANDLE_OPCODE(OP_GT_F): OPC->_float = OPA->_float > OPB->_float; DISPATCH_OPCODE(); - HANDLE_OPCODE(OP_LT): + HANDLE_OPCODE(OP_LT_F): OPC->_float = OPA->_float < OPB->_float; DISPATCH_OPCODE(); - HANDLE_OPCODE(OP_AND): + HANDLE_OPCODE(OP_AND_F): OPC->_float = PRVM_FLOAT_IS_TRUE_FOR_INT(OPA->_int) && PRVM_FLOAT_IS_TRUE_FOR_INT(OPB->_int); // TODO change this back to float, and add AND_I to be used by fteqcc for anything not a float DISPATCH_OPCODE(); - HANDLE_OPCODE(OP_OR): + HANDLE_OPCODE(OP_OR_F): OPC->_float = PRVM_FLOAT_IS_TRUE_FOR_INT(OPA->_int) || PRVM_FLOAT_IS_TRUE_FOR_INT(OPB->_int); // TODO change this back to float, and add OR_I to be used by fteqcc for anything not a float DISPATCH_OPCODE(); HANDLE_OPCODE(OP_NOT_F): @@ -691,6 +691,13 @@ prvm_eval_t *src; HANDLE_OPCODE(OP_IF): //spike FIXME -- dp redefined IF[_I] as IF_F + // TODO: plan is: + // - Add IF_F, IFNOT_F. + // - Rename this to IF_I, IFNOT_I. + // - Add sv_gameplayfix variable to remap IF_I and IFNOT_I to IF_F and IFNOT_F on progs load. + // - Define this fix for Nexuiz. + // - Add generation of IF_F, IFNOT_F instructions to gmqcc. + // - Move Xonotic to that. if(FLOAT_IS_TRUE_FOR_INT(OPA->_int)) // TODO add an "int-if", and change this one, as well as the FLOAT_IS_TRUE_FOR_INT usages, to OPA->_float // although mostly unneeded, thanks to the only float being false being 0x0 and 0x80000000 (negative zero) @@ -873,10 +880,10 @@ prvm_eval_t *src; HANDLE_OPCODE(OP_DIV_FI): OPC->_float = OPA->_float / (prvm_vec_t) OPB->_int; DISPATCH_OPCODE(); - HANDLE_OPCODE(OP_CONV_IF): + HANDLE_OPCODE(OP_CONV_ITOF): OPC->_float = OPA->_int; DISPATCH_OPCODE(); - HANDLE_OPCODE(OP_CONV_FI): + HANDLE_OPCODE(OP_CONV_FTOI): OPC->_int = OPA->_float; DISPATCH_OPCODE(); HANDLE_OPCODE(OP_BITAND_I):