From 25f8d3a23def67c00dc6d193476befb84ac035cb Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Tue, 18 Jan 2022 15:53:31 +0900 Subject: [PATCH] [gamecode] Use pr_type_names.h for type sizes The goal of the previous mess of commits. Ruamoko needs to wait until qfcc has the new types. --- include/QF/progs/pr_comp.h | 4 ++++ libs/gamecode/pr_opcode.c | 19 ++++--------------- ruamoko/lib/types.r | 4 +++- 3 files changed, 11 insertions(+), 16 deletions(-) diff --git a/include/QF/progs/pr_comp.h b/include/QF/progs/pr_comp.h index aff321ffc..7f52cb21d 100644 --- a/include/QF/progs/pr_comp.h +++ b/include/QF/progs/pr_comp.h @@ -25,8 +25,12 @@ typedef int32_t pr_string_t; typedef float pr_float_t; +typedef float pr_vector_t[3]; +typedef uint32_t pr_entity_t; +typedef uint32_t pr_field_t; typedef uint32_t pr_func_t; typedef uint32_t pr_ptr_t; +typedef float pr_quaternion_t[4]; typedef int32_t pr_int_t; typedef uint32_t pr_uint_t; typedef int16_t pr_short_t; diff --git a/libs/gamecode/pr_opcode.c b/libs/gamecode/pr_opcode.c index 0f1cb1258..8fb79e851 100644 --- a/libs/gamecode/pr_opcode.c +++ b/libs/gamecode/pr_opcode.c @@ -33,22 +33,11 @@ #include "QF/progs.h" +typedef pr_type_t pr_void_t; // so size of void is 1 + +#define EV_TYPE(type) (sizeof (pr_##type##_t) / sizeof (pr_int_t)), VISIBLE const pr_ushort_t pr_type_size[ev_type_count] = { - 1, // ev_void - 1, // ev_string - 1, // ev_float - 3, // ev_vector - 1, // ev_entity - 1, // ev_field - 1, // ev_func - 1, // ev_pointer - 4, // ev_quat - 1, // ev_int - 1, // ev_uint - 0, // ev_short value in opcode - 2, // ev_double - 2, // ev_long - 2, // ev_ulong +#include "QF/progs/pr_type_names.h" 0, // ev_invalid not a valid/simple type }; diff --git a/ruamoko/lib/types.r b/ruamoko/lib/types.r index f732cc8d0..0445e0510 100644 --- a/ruamoko/lib/types.r +++ b/ruamoko/lib/types.r @@ -11,8 +11,10 @@ string ty_meta_name[7] = { "alias", }; -//FIXME use pr_type_names.h +//FIXME use pr_type_names.h, but need to fix unsigned, and add missing types +//#define EV_TYPE(type) sizeof(type), int pr_type_size[ev_type_count] = { +//#include 1, // ev_void 1, // ev_string 1, // ev_float